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

来源:互联网 发布:淘宝信用贷款额度降低 编辑:程序博客网 时间:2024/05/16 06:00

当你看到这样的错误:

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方法中一个简单的数据库连接(进行一次全新的连接,非程序运行期连接池错误),那么你不妨换一下数据库驱动版本。

阅读全文
0 0
原创粉丝点击