DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=36799>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=36799

           Summary: Docs inaccurately describe default value of testOnBorrow
           Product: Commons
           Version: unspecified
          Platform: Other
               URL: http://jakarta.apache.org/commons/dbcp/configuration.htm
                    l
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Dbcp
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: [EMAIL PROTECTED]


On the page http://jakarta.apache.org/commons/dbcp/configuration.html, the 
Default column for the testOnBorrow parameter says that testOnBorrow is set by 
default to "true". I observe from the behaviour of my application that this 
seems to be true only if validationQuery is not set to null. Further, I find 
this code in the BasicDataSource.java file, createDataSource method:
        // Can't test without a validationQuery
        if (validationQuery == null) {
            setTestOnBorrow(false);
            setTestOnReturn(false);
            setTestWhileIdle(false);
        }

Users may think that DBCP uses a default validationQuery such as "SELECT 1" if 
you don't set one up explicitly, and that therefore setting testOnBorrow 
without setting validationQuery is legitimate. This is what I naively thought -
 although on reflection I can see why you don't, for reasons of portability.

It would be very helpful if the documentation explained this, with text like 
this:
"The testOnBorrow, testOnReturn, and testWhileIdle parameters are defaulted to 
true if and only if you supply a non-null value for the validationQuery 
parameter."

It would be even more helpful if BasicDataSource noticed that testOnBorrow was 
set to true without a valid validationQuery setting, and logged something like
"Disabling testOnBorrow, testOnReturn, and testWhileIdle because no 
valiationQuery was supplied. To enable these settings you must also supply a 
validationQuery, typically a very simple query like 'SELECT 1'".

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to