cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Santiago Gala <sg...@hisitech.com>
Subject Re: [c2] still problem with datasources
Date Mon, 23 Apr 2001 18:41:27 GMT
Berin Loritsch wrote:

> Donald Ball wrote:
> 
>> fwiw, i'm still having problems with the datasource manager not noticing
>> connection timeout until after it's given me a stale connection.
> 
> 
> Ok.  I am checking the isClosed() to see if the connection is stale.  Is there
> anything else I should check?
> 

I think this will not work always.

I seem to remember having seen code somewhere that actually called a 
PerparedStatement containing "SELECT 1" to check if there was any 
problem with the actual socket connection. This can be done in the 
background every so and so time or before giving it to the requester...

I'm not sure it is a good solution, but it could be a strategy that is 
configured for buggy drivers or buggy databases.

I'm looking at the postgres implementation (what I have at hand, not 
latest and greatest), and isClosed() will work if the closing occurs in 
the java side (i.e., the user closed the connection before returning it 
back), but it will fail if the close took place in the server side, as 
the driver never probes the actual socket. In fact, if any IOException 
is returned because the socket was closed, the connection will remain 
broken until you discard the socket by closing it. In general it is 
difficult, unless the JDBC driver/DB protocol has a keep-alive 
mechanism, to ensure that java will notice server closing unless you 
actually try to send something down the wire.


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message