欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

mysql- Communications link failureons

程序员文章站 2022-06-07 14:46:15
...
mysqlhibernatefailure

自己做的第一个信息类网站,第一次访问主页时能够正确显示,但过几分钟后刷新该页面是就会报错:错误类型如下:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet successfully received from the server was 1,649,969 milliseconds ago. The last packet sent successfully to the server was 2 milliseconds ago

.
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
java.lang.reflect.Constructor.newInstance(Constructor.java:513)
com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1127)
com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3715)
在网上查了一些解决方案,比如设置mysql参数“wait_timeout”等等都不奏效。求大神指点。。(ps: 用的是Hibernate访问数据库,MySQL版本为5.6的)