1 message in com.mysql.lists.javaautoReconnect vs. wait_time=<infinity>| From | Sent On | Attachments |
|---|---|---|
| Andy Wadsworth | 12 Feb 2004 18:45 |
| Subject: | autoReconnect vs. wait_time=<infinity>![]() |
|---|---|
| From: | Andy Wadsworth (and...@bondmart.com) |
| Date: | 02/12/2004 06:45:05 PM |
| List: | com.mysql.lists.java |
I have a need to keep a Connection open as long as my application is running even though there may be periods of time as long as 3 days where the connection is idle. I've seen two ways to manage the timeout and I'm wondering what the tradeoffs are between these two:
use "autoReconnect=true" when creating the connection: This appears to work, but I had one case where my transaction appeared to timeout waiting for the reconnect, and thus, the transaction had to be rolled back. This is highly undesireable for my application so I don't think I can use this one.
execute the statement "set session wait_timeout=31536000" This one works, but I suspect there's a downside that the connection can remain open if your application doesn't properly shutdown the connection. So, if this happens very often, you would need to reboot to get back those connections.
FYI, the wait_timeout appears to be capped at 31536000 seconds (roughly 10 years). So, if you specify "Integer.MAX_VALUE", you'll actually see 31536000 used.
Thanks for the info, Andy.
############################### # Andy Wadsworth # # # # BondMart Technologies, Inc. # # and...@bondmart.com # # # ############################### As long as there are tests, there will be prayer in public schools




