commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig McClanahan <>
Subject Re: Connection is closed
Date Mon, 29 Mar 2004 21:13:48 GMT
Joao Batistella wrote:

>I do that. I only deal with the connection returned by DBCP. Is there a
>timeout attribute (or anyother thing) that can close the connection?
A "connection closed" error can be caused by the database end.  For 
example, if your database is configured for connections to time out, the 
database will do so without DBCP even knowing about it -- and I'm fairly 
certain that Oracle supports such a configuration option.

A conventional approach to dealing with this is to set the 
"validationQuery" property to some SQL statement that will be used to 
validate whether a connection is alive before it's returned to you from 
getConnection() -- something like "SELECT 1 FROM DUAL" works fine for 
Oradle.  The pool will then detect that the "real" connection can't be 
used any more, close it, and then go grab a new one, without your 
application having to worry about this situation.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message