java.sql.sqlexception:无法检索事务只读状态服务器

v1uwarro  于 2021-06-17  发布在  Mysql
关注(0)|答案(0)|浏览(198)

我正在使用 mysql-connector-java-5.1.8-bin.jar ,有谁能为我提供以下例外情况的解决方案:
尝试插入db得到以下结果:

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)

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题