MySQL Forums
Forum List  »  Connector/JDBC and Java

CORRECT SOLUTION: Communications link failure due to underlying exception
Posted by: Bohdan Bobylak
Date: May 18, 2006 10:22AM

While reading this post I did not find the correct explanation and solution for the problem.
So I desided to write one (I hope it will help all of you).

The 'Communications link failure due to underlying exception' problem usually occures because MySQL closes connection too soon. To avoid this you should rise up the wait timeout limit for MYSQL connection. To do this you have to add or modify the 'wait_timeout' option into the [mysqld] section of the /etc/my.cnf file (for Windows users the my.cnf files is located in a different place; so please read the MySQL docs to find out were it is located).

Example MySQL config file /etc/my.cfg with TOO low timeout:
-----------------------------
[mysqld]
...
wait_timeout=15
...
-----------------------------

After rising up the 'wait_timeout' value:
-----------------------------
[mysqld]
...
wait_timeout=500
...
-----------------------------
and restarting MySQL the problem should disapear.

NOTE: if is does not help try adding ?autoReconnect=true to the JDBC driver url.

Best regards.

Options: ReplyQuote


Subject
Written By
Posted
CORRECT SOLUTION: Communications link failure due to underlying exception
May 18, 2006 10:22AM
June 09, 2006 04:42AM
August 24, 2006 05:27PM
July 15, 2007 04:27AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.