Breaking News
Home / Java / Java Issues / JDBC – link failure CommunicationsException

JDBC – link failure CommunicationsException


Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
      at com.mysql.jdbc.SQLError.createCommunicationsException(
     at com.mysql.jdbc.MysqlIO.<init>(
     at com.mysql.jdbc.ConnectionImpl.coreConnect(
     at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(
     at com.mysql.jdbc.ConnectionImpl.createNewIO(
     at com.mysql.jdbc.ConnectionImpl.<init>(
     at com.mysql.jdbc.JDBC4Connection.<init>(
     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
     at sun.reflect.NativeConstructorAccessorImpl.newInstance(

     at java.lang.reflect.Constructor.newInstance(
     at com.mysql.jdbc.Util.handleNewInstance(
     at com.mysql.jdbc.ConnectionImpl.getInstance(
     at com.mysql.jdbc.NonRegisteringDriver.connect(
     at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(
     at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(
     at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(
     at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(
     … 14 more
Caused by: Connection refused
     at Method)
     at com.mysql.jdbc.StandardSocketFactory.connect(
     at com.mysql.jdbc.MysqlIO.<init>(
     … 30 more


In this scenario the Database seems to be down (has crashed) or not reachable (firewall blocking the port) or invalid configuration(check host/ port or the sock descriptor). Once the source of the problem as stated above is fixed, it may be necessary to restart your program, server or the database connection pool if applicable to reinitialize the connection. 


Check Also

Data truncation: Data too long for column – JDBC

Issue Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column ‘columname‘ at row 1     …

Advertisment ad adsense adlogger