tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: mysql timeout
Date Mon, 01 Dec 2008 19:06:42 GMT
Hash: SHA1


AD wrote:
>  I am trying to troubleshoot an error that seems to occur quite frequently
> with no real solution.  I constantly see
> com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link
> failure in my application after the app runs for a few days.  Communication
> is fine, networking is fine, netstat even shows connected sessions.  It
> appears one of the connection went stale but it is still being returned from
> the pool.  I did some reading and it appears there are 2 options
> 1 - Set wait_timeout in MySQL very high , but still risky

You shouldn't have to do this.

> 2 - use something like DBCP to enforce a validation query for the connection
> from the pool.

If you are using a <Resource> element in your context.xml file, then you
are already using a DBCP. Just add the "validationQuery" attribute to
your <Resource> element:

<Resource ...
  validationQuery="SELECT 1"

You can use validationQuery="/* ping */SELECT 1" if you want, and
Connector/J will ping the server instead(?) of issuing the SELECT query.

- -chris
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla -


To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message