我还在 JDBC 连接字符串中使用 keepalive=10,并将
wait_timeout
设置为 28800
。
您能帮我解决以下错误吗?
The last packet successfully received from the server was 12,053,926 milliseconds ago. The last packet sent successfully to the server was 12,053,926 milliseconds ago.
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet successfully received from the server was 12,053,926 milliseconds ago. The last packet sent successfully to the server was 12,053,926 milliseconds ago.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
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:409)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1127)
at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3983)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2596)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2776)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2832)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2781)
at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1569)
at com.mysql.jdbc.DatabaseMetaData.getUserName(DatabaseMetaData.java:7013)
Caused by: java.net.SocketException: Connection timed out (Write failed)
您找到这个问题的答案了吗,因为我也有同样的问题? 谢谢