tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael <sg...@gmx.net>
Subject Re: [Tomcat JDBC Pool] Close pooled connections via JMX
Date Mon, 05 Mar 2012 20:54:30 GMT
Chema schrieb:
> 2012/3/5 Michael <sgfan@gmx.net>:
>> Chema schrieb:
>>
>>>>> Do you have testOnBorrow="true" and a validationQuery="SELECT 1 FROM
>>>>> DUAL" configured?
>>>>>
>>>>> This should suffice to ensure each connection is valid before use.
>>>>
>>>> Pid,
>>>>
>>>> works like a charms. Thanks very much.
>>>>
> 
>> It executes the validation query and checks if there is no SQLException.
> 
> Thanks ...but , if you only restart the remote db , the query "SELECT
> 1 FROM DUAL" always works , am I wrong ?

No if the connection has been reset by the instance. The query will 
result in a SQLException. You have to close the connection and open a 
new one. The query works on an open connection only. That's the point.
See the second paragraph of this [1].

Mike

[1] 
http://docs.oracle.com/javase/6/docs/api/java/sql/Connection.html#isClosed%28%29

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message