Uploaded image for project: 'Commons DbUtils'
  1. Commons DbUtils
  2. DBUTILS-138

org.apache.commons.dbutils.QueryRunner.query(Connection, boolean, String, ResultSetHandler<T>, Object...) Exception in closing statement leave connections open

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.7
    • 1.8.0
    • 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>)

      Attachments

        Activity

          People

            thecarlhall Carl Franklin Hall
            satollo Stefano Lissa
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: