diff --git a/src/main/java/com/alibaba/druid/pool/PoolableConnection.java b/src/main/java/com/alibaba/druid/pool/PoolableConnection.java index 6ce6c97072..2920ee6d99 100644 --- a/src/main/java/com/alibaba/druid/pool/PoolableConnection.java +++ b/src/main/java/com/alibaba/druid/pool/PoolableConnection.java @@ -81,6 +81,10 @@ public class PoolableConnection implements PooledConnection, Connection { } void closePoolableStatement(PoolablePreparedStatement stmt) throws SQLException { + if (this.isClosed()) { + return; + } + PreparedStatement rawStatement = stmt.getRawPreparedStatement(); try { @@ -88,6 +92,10 @@ public class PoolableConnection implements PooledConnection, Connection { } catch (SQLException ex) { LOG.error("clear parameter error", ex); } + + if (holder == null) { + return; + } if (holder.isPoolPreparedStatements()) { stmt.clearResultSet();