commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk Verbeeck <dirk.verbe...@pandora.be>
Subject Re: [DBCP] Question to database reconnection
Date Wed, 11 Aug 2004 19:48:14 GMT
During the connection activation (when borrowing a connection) the 
setAutoCommit and other connection init methods are called.
If one of these methods throws a SQLException then the connection is 
also considered broken and removed from the pool.

So if you are using one of the "default*" properties and the JDBC 
driver correctly reports the SQLExceptions on the "set*" methods then 
you don't need an extra validationQuery.

Can you post the database+driver+config you are using?
Or even better, make a FAQ item of this in the DBCP wiki.

-- Dirk

Leber, Dieter wrote:
> I'm using DBCP 1.2 without using any validation of the connections 
> (testOnBorrow = false, testOnReturn = false, timeBetweenEvictionRunsMillis = -1). 
> 
> When shutting down the database during running the application, the 
> request using a pooled connection realizes that the database is down. 
> Returning the connection to the pool seems to clean the pool (i.e. the 
> pool has no active nor idle connections any longer). 
> 
> Starting the database again and demanding a connection from the 
> pool a new connection is returned which has never been in the pool before.
> 
> If this is right no reconnection handling is needed at all because we always
> have valid connections every time the database was down and started up again.
> 
> Can anyone please throw any light on this behaviour!? Are there 
> situations where the pool is not cleaned so that validation is actually 
> needed?
> 
> Dieter Leber



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


Mime
View raw message