1

I am using mysql-connector-java-5.1.8-bin.jar, Can anyone suggest me the solution for below exception:

Trying to insert into DB got this below:

java.sql.SQLException: Could not retrieve transation read-only status server

java.sql.SQLException: Could not retrieve transation read-only status server
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:996)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:935)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:924)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:870)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:902)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:892)
    at com.mysql.jdbc.ConnectionImpl.isReadOnly(ConnectionImpl.java:3607)
    at com.mysql.jdbc.ConnectionImpl.isReadOnly(ConnectionImpl.java:3576)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2107)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2077)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2062)
    at com.imi.mlogserverj.alt.loggers.BulkInsertLogger.logIntoTable(BulkInsertLogger.java:392)
    at com.imi.mlogserverj.loggers.LoggerQueue$LoggerQueueWorker.loadData(LoggerQueue.java:354)
    at com.imi.mlogserverj.loggers.LoggerQueue$LoggerQueueWorker.run(LoggerQueue.java:242)

Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 101,250,342 milliseconds ago.  The last packet sent successfully to the server was 101,250,343 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.
    at sun.reflect.GeneratedConstructorAccessor15.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:377)
    at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1036)
    at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3661)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2417)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2582)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2526)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2484)
    at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1446)
    at com.mysql.jdbc.ConnectionImpl.isReadOnly(ConnectionImpl.java:3601)
    ... 7 more

Caused by: java.net.SocketException: Broken pipe
    at java.net.SocketOutputStream.socketWrite0(Native Method)
    at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109)
    at java.net.SocketOutputStream.write(SocketOutputStream.java:153)
    at `enter code here`java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
    at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
    at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3643)
Lakhwinder Singh
  • 5,536
  • 5
  • 27
  • 52
Ravi A
  • 31
  • 5

0 Answers0