关于MySQL:Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link fail

xiaoxiao2021-02-28  67

当你看到这样的错误:

Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet successfully received from the server was 19 milliseconds ago.  The last packet sent successfully to the server was 19 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:425) at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:989) at com.mysql.jdbc.ExportControlled.transformSocketToSSLSocket(ExportControlled.java:164) at com.mysql.jdbc.MysqlIO.negotiateSSLConnection(MysqlIO.java:4898) at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1659) at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1226) at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2253) at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2104) ... 13 more 也许你第一会想到什么配置数据库 wait_timeout大于8小时,但是如果设置后也不行,而且这是在普通的main方法中一个简单的数据库连接(进行一次全新的连接,非程序运行期连接池错误),那么你不妨换一下数据库驱动版本。

转载请注明原文地址: https://www.6miu.com/read-62461.html

最新回复(0)