Re: Communications link failure due to underlying exception
I was also getting this error and have resolved it.
The error occurs when the MySql database terminates a connection. In my case this occurred after one hour of disuse which is the timeout setting we configured in MySql. I imagine restarting MySql would also cause the problem. After this occurs, despite autoReconnect=true I woudl get the Communication link failure.
I am using Tomcat so my connection properties are specified in the server.xml file lke this:
<ResourceParams name="jdbc/directory">
<parameter><name>factory</name><value>org.apache.commons.dbcp.BasicDataSourceFactory</value></parameter>
<parameter><name>username</name><value>user</value></parameter>
<parameter><name>driverClassName</name><value>com.mysql.jdbc.Driver</value></parameter>
<parameter><name>url</name><value>jdbc:mysql://mycompany.com/directory?autoReconnect=true&jdbcCompliantTruncation=false&elideSetAutoCommits=true&useLocalSessionState=true&maintainTimeStats=false</value></parameter>
<parameter><name>removeAbandoned</name><value>true</value></parameter>
<parameter><name>removeAbandonedTimeout</name><value>60</value></parameter>
<parameter><name>logAbandoned</name><value>true</value></parameter>
<parameter><name>maxActive</name><value>1000</value></parameter>
<parameter><name>maxIdle</name><value>500</value></parameter>
<parameter><name>maxWait</name><value>10000</value></parameter>
</ResourceParams>
Notice the line: <parameter><name>url</name><value>jdbc:mysql://mycompany.com/directory?autoReconnect=true&jdbcCompliantTruncation=false&elideSetAutoCommits=true&useLocalSessionState=true&maintainTimeStats=false</value></parameter>
This works and avoid the Communication link failure. Earlier I had been using:
<parameter><name>connectionProperties</name><value>autoReconnect=true;autoReconnectForPools=true;jdbcCompliantTruncation=false;elideSetAutoCommits=true;useNewIO=false;useLocalSessionState=true;maintainTimeStats=false</value></parameter>
<parameter><name>url</name><value>jdbc:mysql://mycompany.com/search</value></parameter>
which should be equivalent. My guess is that the jdbc Connector/J 3.1.10 driver has a bug dealing with autoReconnect parameters passed via the connectionParameters instead of the queryString portion of the url.
Hope this helps someone!
Subject
Written By
Posted
February 22, 2005 01:11AM
February 22, 2005 02:54AM
February 22, 2005 10:38AM
February 22, 2005 11:48AM
November 01, 2007 09:32AM
Re: Communications link failure due to underlying exception
July 15, 2005 08:52AM
November 01, 2006 05:52AM
November 30, 2006 11:31PM
November 30, 2006 11:37PM
December 01, 2006 12:44AM
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.