tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arnaud Kleinveld <arnaud.kleinv...@ybo.com.sg>
Subject Re: connection autoReconnect?
Date Thu, 22 Nov 2012 06:14:20 GMT
Ok. The validation query solves this problem we concluded. Confirmed with
testing as well.

Our Resource looks like this now
<Resource auth="Container" driverClassName="com.mysql.jdbc.Driver"
            name="jdbc/xxxxxxxx" type="javax.sql.DataSource"
            username="xxxxxxxx" password="xxxxxxx"
            url="jdbc:mysql://localhost:3306/xxxxxxx"
            validationQuery="/* ping */ SELECT 1" testWhileIdle="true"/>

Because of using MySQL we have this specific validation query. Which has to
be exactly lower-case and with spaces as above says the documentation
otherwise it will not work. Get the right validation query if you use a
different type of database.

We chose to run the validation/cleaner thread by setting testWhileIdle
instead of testOnBorrow. Which works fine too and prevents your application
to run the validationQuery every single time when processing high loads.

We have done a test by setting wait_timeout to 90 seconds and reusing the
connections with our application after MySQL had closed them. No exceptions
were thrown.  Even within the 5 seconds after the connection had be closed.



--
View this message in context: http://tomcat.10.n6.nabble.com/connection-autoReconnect-tp4340944p4989963.html
Sent from the Tomcat - User mailing list archive at Nabble.com.

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


Mime
View raw message