Commons Dbcp
  1. Commons Dbcp
  2. DBCP-154

[dbcp] PoolableConnectionFactory.validateConnection() should log exception message

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.0
    • Fix Version/s: 2.0
    • Labels:
      None
    • Environment:

      Operating System: other
      Platform: All

      Description

      Since PoolableConnectionFactory.validateObject() doesn't pass up the exception
      from validateConnect(), the latter needs to log it somehow. Otherwise the user
      of the library only knows that there was a problem retrieving a connection. To
      fix the problem they will doubtless need to know the error being reported by the
      database. The following patch is probably not good to apply, but it gives an
      idea of what I think should be logged.

      Index: src/java/org/apache/commons/dbcp/PoolableConnectionFactory.java
      ===================================================================
      RCS file:
      /home/cvspublic/jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/PoolableConnectionFactory.java,v
      retrieving revision 1.15
      diff -u -p -u -r1.15 PoolableConnectionFactory.java
      — src/java/org/apache/commons/dbcp/PoolableConnectionFactory.java 9 Oct
      2003 21:04:44 -0000 1.15
      +++ src/java/org/apache/commons/dbcp/PoolableConnectionFactory.java 14 Nov
      2003 22:48:31 -0000
      @@ -339,6 +339,8 @@ public class PoolableConnectionFactory i
      if(!rset.next())

      { throw new SQLException("validationQuery didn't return a row"); }

      + } catch (Exception e)

      { + System.err.println("PoolableConnectionFactory.validationConnection: connection validation with query \"" + query + "\" failed: " + e); }

      finally {
      try {
      rset.close();

        Activity

        Noah Levitt created issue -
        Henri Yandell made changes -
        Field Original Value New Value
        issue.field.bugzillaimportkey 24718 12340358
        Henri Yandell made changes -
        Project Commons [ 12310458 ] Commons Dbcp [ 12310469 ]
        Affects Version/s 1.0 Alpha [ 12311665 ]
        Component/s Dbcp [ 12311109 ]
        Assignee Jakarta Commons Developers Mailing List [ commons-dev@jakarta.apache.org ]
        Key COM-207 DBCP-154
        Henri Yandell made changes -
        Affects Version/s 1.0 Alpha [ 12311708 ]
        Hide
        Phil Steitz added a comment -

        Include in logging refactoring.

        Show
        Phil Steitz added a comment - Include in logging refactoring.
        Phil Steitz made changes -
        Bugzilla Id 24718
        Fix Version/s 1.3 [ 12311977 ]
        Hide
        Mark Thomas added a comment -

        Pushing anything logging related to 1.4.

        Show
        Mark Thomas added a comment - Pushing anything logging related to 1.4.
        Mark Thomas made changes -
        Fix Version/s 1.4 [ 12312615 ]
        Fix Version/s 1.3 [ 12311977 ]
        Phil Steitz made changes -
        Fix Version/s 2.0 [ 12313721 ]
        Fix Version/s 1.4 [ 12312615 ]
        Hide
        Mark Thomas added a comment -

        Validation failures are now logged.

        This fix required adding a dependency on Commons Logging.

        Show
        Mark Thomas added a comment - Validation failures are now logged. This fix required adding a dependency on Commons Logging.
        Mark Thomas made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Phil Steitz made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        3539d 2h 16m 1 Mark Thomas 24/Jul/13 10:05
        Resolved Resolved Closed Closed
        579d 18h 18m 1 Phil Steitz 24/Feb/15 03:23

          People

          • Assignee:
            Unassigned
            Reporter:
            Noah Levitt
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development