commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig McClanahan <craig...@gmail.com>
Subject Re: [DBCP] Question to database reconnection
Date Wed, 11 Aug 2004 16:43:57 GMT
On Wed, 11 Aug 2004 17:00:33 +0200, Leber, Dieter
<dieter.leber@ndsatcom.com> 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?

If the JDBC driver for your database does the transparent reconnect
thing (inside a Connection) for you, then there would not be a need to
have your connection pool do it.  My experience is that such a JDBC
driver is a rare animal.

The other thing that test-on-borrow helps you with, besides database
server restarts, is a connection that has been alive but idle for
longer than some timeout value built in to the database.  I've seen
this happen, for example, on Oracle databases with lightly used
applications (such as overnight) ... even though the database was not
shut down, the connections got stale.  Without a testOnBorrow
validation, my applications would have to deal with the resulting
SQLExceptions.  With testOnBorrow, the connection pool takes care of
it for me.

> 
> Dieter Leber
> 

Craig

---------------------------------------------------------------------
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