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-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to