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

Mike Curwen wrote:

> when you specify the connection to mysql, are you including the
> 'autoreconnect=true' parameter? If not, the connections will be closed
> by mysql after (I think) 8 hrs.
>

I wish I could kill the 'autoReconnect' feature. You shouldn't be using
it if you're using a connection pool :)

Use the correct properties on your connection pool and you should be
good to go.

For example, setting 'timeBetweenEvictionRunsMillis' (set to some
sensible number of milliseconds, I would suggest something around 5
minutes) and 'minEvictableIdleTimeMillis' (set to the number of
milliseconds you have 'wait_timeout' set to on the server minus some %)
 should catch MySQL closing idle connections.

Setting 'validationQuery' (set to 'SELECT 1') and 'testOnBorrow' or
'testOnReturn' should catch MySQL server restarts or general network
flakiness.

In any case, you should also see the new example in the troubleshooting
section of the Connector/J docs that shows how your code can also detect
whether a SQLException was caused by a lost connection, or some other
error (section 4.4 under the following link):

http://www.mysql.com/documentation/connector-j/index.html#id2803835


        -Mark (the guy who wrote the 'autoReconnect' functionality, and now
wishes he could remove it from the JDBC driver)

- --
Mr. Mark Matthews
MySQL AB, Software Development Manager, J2EE and Windows Platforms
Office: +1 708 332 0507
www.mysql.com

Meet the MySQL Team! April 14-16, 2004 http://www.mysql.com/uc2004/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFAUe8FtvXNTca6JD8RAmpmAJ0Wq/1rT/Fcw40H4fB1/g8UmheonACbBYwU
mpRzou4Jb2yXUsGSNooLCKs=
=DW3u
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to