commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk Verbeeck <>
Subject Re: cvs commit: jakarta-commons/dbcp/src/java/org/apache/commons/dbcp
Date Wed, 27 Aug 2003 22:20:13 GMT
A little more context

The old behaviour was:
- if nothing set then do nothing
- if validationQuery was set then testOnBorrow was auto-enabled and 
couldn't be disabled, you could only add testOnReturn & testOnBorrow

The new behaviour is:
- if nothing set then do nothing
- if one or more tests are enabled then do those tests
- if no tests are enabled but there is a validationQuery then 
auto-enable testOnBorrow.

It was impossible to disable the testOnBorrow because the statement is 
inside the createDataSource()
and once the datasource is created then you can't change the properties 

It could be more improvements. Like you described.
Even when you now set testOnBorrow to false but provide a 
validationQuery then it is changed to true (I don't like that)
and you should be able to change the properties after the datasource is 
created. (the datasource is created on first use).

The patch is a small step in the good direction and many small steps...


Noel J. Bergman wrote:

>>Bugzilla Bug 22750: BasicDataSource always sets testOnBorrow if given
>>a validation query
>>Only enable TestOnBorrow when testOnReturn  & testWhileIdle are not set
>Why is this a bug?  Just because a connection was valid when it was
>returned, and just because it hasn’t YET been detected by the whileIdle
>mechanish, does NOT mean that the connection is still valid when it is
>I think that BasicDataSource should default to conservative behavior, and
>let the user disable it, rather than the other way around.
>If the user doesn’t want this behavior, let them disable it by calling
>setTestOnBorrow.  The real bug is in that method.  The various methods that
>cover the connectionPool configuration are only setting the local value.
>They should also be calling the connectionPool method if connectionPool is
>not null.
>	--- Noel

View raw message