Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
1.7
-
SQL Server 2012, Java 8, MS JDBC Driver 4.
Description
On class QueryRunner starting at line 393 (see the snippet below) if the statement close attempt results in an exception, the connection is not closed correctly. I was not able to intercept the exception since it happens in a production environment with SQL Server 2012, Java 8 and original MS drivers, but the effect is the connection pool fills up and finally starts to log abandoned connections opened by QueryRunner.
} finally { try { close(rs); } finally { close(stmt); if (closeConn) { close(conn); } } }
This is in the private method org.apache.commons.dbutils.QueryRunner.query(Connection, boolean, String, ResultSetHandler<T>, Object...).
This private method is called by:
- org.apache.commons.dbutils.QueryRunner.query(Connection, String, Object, ResultSetHandler<T>)
- org.apache.commons.dbutils.QueryRunner.query(Connection, String, Object[], ResultSetHandler<T>)
- org.apache.commons.dbutils.QueryRunner.query(Connection, String, ResultSetHandler<T>, Object...)
- org.apache.commons.dbutils.QueryRunner.query(Connection, String, ResultSetHandler<T>)
- org.apache.commons.dbutils.QueryRunner.query(String, Object, ResultSetHandler<T>)
- org.apache.commons.dbutils.QueryRunner.query(String, Object[], ResultSetHandler<T>)
- org.apache.commons.dbutils.QueryRunner.query(String, ResultSetHandler<T>, Object...)
- org.apache.commons.dbutils.QueryRunner.query(String, ResultSetHandler<T>)