I have a web application that uses ConnectorJ to connect to a MySQL database. When I had MySQL on windows, I never had a problem. However, now that I'm running MySQL on a linux box, I get a weird problem:

If I have not logged in to MySQL through the mysql command-line utility in a while, the web application cannot connect to the database. When it tries to connect through JDBC, it comes back with a communication link error. This continues until I log in (through a bash prompt) with the mysql command-line utility. Then the web app can suddenly get through. Does anyone know why this is? What might be causing this? How can I stop this from happening?

I'm not 100% sure, but I think what might be happening is this:
1. Connection Pool Manager creates connection and returns it
2. Connection is used by app, close() called and is returned to pool
3. Connection not used for long time, mysql times it out
4. Pool manager doesn't know it's timed out, returns it when connection asked for


Does this sound correct? If this is the problem, how would I fix this? Unfortunately, the javax.sql.PooledConnection and Listener interfaces don't offer any callbacks for timeouts. So how would I timeout a connection? Or should I, before returning a pooled connection, test it first? The only thing is this adds an extra trip to the DB for every time someone asks for a connection. But I don't see any other way to handle this, except maybe the timeout on a connection in the "idle" pool?





_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail



--------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



Reply via email to