commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Holly, Michael" <mho...@talisentech.com>
Subject RE: Connection is closed
Date Tue, 30 Mar 2004 13:55:15 GMT
Another possibility... This may or may not fit your situation,  if you have a firewall between
your box and the database it may be timing out the connection.

Michael

-----Original Message-----
From: Joao Batistella [mailto:joao-p-batistella@ptinovacao.pt] 
Sent: Tuesday, March 30, 2004 2:41 AM
To: 'Jakarta Commons Users List'
Subject: RE: Connection is closed


I've already set the validationQuery to test the connection. 
This (the connection is closed error) doesn't happen so often, only sometimes. But it's strange
because there is no pattern. The most strange thing is that I haven't had this error while
not using DBCP... I was using a direct JDBC connection, without a connection pool. This is
because I was asking if DBCP could close the connection after some time.

Thanks for your help.
JP

-----Original Message-----
From: Craig McClanahan [mailto:craigmcc@apache.org]
Sent: segunda-feira, 29 de março de 2004 21:14
To: Jakarta Commons Users List
Subject: Re: Connection is closed


Joao Batistella wrote:

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

Craig


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

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