-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Thomas,

Thomas Haines wrote:
| mysql connector 5.1.6

Is that a pre-release version, or did 5.1 become GA recently?

| ERROR (21-06-08 07:59) [servlets.ViewEmail]
| com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet
| successfully received from the server was 46859 seconds ago.The last
| packet sent successfully to the server was 46859 seconds ago, which  is
| longer than the server configured value of 'wait_timeout'. You should
| consider either expiring and/or testing connection validity before use
| in your application, increasing the server configured values for client
| timeouts, or using the Connector/J connection property
| 'autoReconnect=true' to avoid this problem.

That's strange... the error message says "use autoReconnect" but the
driver documentation says "don't use autoReconnect anymore". In either
case, you're better off setting a "validationQuery" attribute in your
<Resource> that can check for good connections (like 'SELECT 1').

| a) downgrade to MySQL Connector/J 5.0.8 and see if this fixes it;

This may fix your problem, but probably not. The problem with
autoReconnect is that it doesn't fix your current connection for the
current query -- your first post-disconnect query will fail, and then
the next one will succeed.

| b) add a while (!verified && attempts<2) type loop in getConnection()
| method to query the DB using a minimal query and then catch the first
| dead connection.

Using 'validationQuery' achieves the same goal without modifying your
code (which is always nice).

| I'm not overly keen on introducing the additional overhead of querying
| the DB just to check if it is valid every time a request is made for a
| connection.  Does anyone have any thoughts on how I might debug/solve
| this issue?

I think your options are to use a validationQuery (like just about
everyone else) or to create connections from scratch whenever you need
them. 'SELECT 1' overhead is very low.

I seem to recall that newer versions of the MySQL driver could ping the
server or something like that to keep connections alive. Check the
documentation for your driver version to see if there's anything like that.

| I've searched widely on Google to no avail.  Interestingly,
| there is another instance of tomcat communicating with MySQL on the
| machine, exactly the same configuration, that doesn't suffer these
| woes.

What are the differences? Is it possible that the db connection just
never times out (because it gets light, regular traffic)?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkhdH0AACgkQ9CaO5/Lv0PAmTgCdHxlVgNyVGczY+DrUrLOdGTUC
U5EAnAyth71m1i2BWZtkyGkb+4cFjABP
=ytap
-----END PGP SIGNATURE-----

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

Reply via email to