Tuesday, August 18, 2009

Communication link failure, Mysql JDBC connection

Dear Reader,
  I am using mysql 5.0.x connector and tomcat 5.5.x DBCP. If you get this error in your application:-

com.mysql.jdbc.CommunicationsException: Communications link failure Last packet sent to 
the server was 1553186 ms ago.
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1070)
at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3246) 
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1917)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2465)
at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1383) at
org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208)
at com.adobe.gep.database.managers.DBConnection.executeQuery(DBConnection.java:76)

Caused by: java.net.SocketException: Connection reset
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:96)
at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3227)

Don't panic:-
Just see whether firewall is disabled on that mysql port or not. If not, then disable that firewall.
You can see that using this command:
//Command
service iptables status

Then you can stop this using below command:
service iptables stop

-------------------End------------------

No comments:

Post a Comment