tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: mysql timeout
Date Mon, 01 Dec 2008 19:06:42 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Adam,

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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkk0NcIACgkQ9CaO5/Lv0PAFuQCfZNlGCdGrcLnS2xer1UNYQJ1c
/JQAnA9vvi6UdTphh3eBv04lC37G8PRL
=4Z+h
-----END PGP SIGNATURE-----

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


Mime
View raw message