commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 24718] New: - PoolableConnectionFactory.validateConnection() should log exception message
Date Fri, 14 Nov 2003 22:49:05 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24718>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24718

PoolableConnectionFactory.validateConnection() should log exception message

           Summary: PoolableConnectionFactory.validateConnection() should
                    log exception message
           Product: Commons
           Version: 1.0 Alpha
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Dbcp
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: nlevitt@columbia.edu


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();

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message