You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary Gregory (JIRA)" <ji...@apache.org> on 2018/05/04 16:25:00 UTC

[jira] [Resolved] (DBUTILS-138) org.apache.commons.dbutils.QueryRunner.query(Connection, boolean, String, ResultSetHandler, Object...) Exception in closing statement leave connections open

     [ https://issues.apache.org/jira/browse/DBUTILS-138?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary Gregory resolved DBUTILS-138.
----------------------------------
    Resolution: Fixed

Fixed in git master. Please verify and close. You can build the code or point your Maven POM to the 2.0-SNAPSHOT version.

> org.apache.commons.dbutils.QueryRunner.query(Connection, boolean, String, ResultSetHandler<T>, Object...) Exception in closing statement leave connections open
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DBUTILS-138
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-138
>             Project: Commons DbUtils
>          Issue Type: Bug
>    Affects Versions: 1.7
>         Environment: SQL Server 2012, Java 8, MS JDBC Driver 4.
>            Reporter: Stefano Lissa
>            Priority: Minor
>              Labels: connectionloss
>
> 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.
> {code:java}
>         } finally {
>             try {
>                 close(rs);
>             } finally {
>                 close(stmt);
>                 if (closeConn) {
>                     close(conn);
>                 }
>             }
>         }
> {code}
> 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>)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)