Communications link failure的解决办法

来源:互联网 发布:淘宝下架宝贝找不到 编辑:程序博客网 时间:2024/05/17 23:33

Communications link failure的解决办法

使用Connector/J连接MySQL数据库,程序运行较长时间后就会报以下错误:
Communications link failure,The last packet successfully received from the server was * millisecond ago.The last packet successfully sent to the server was * millisecond ago


在尝试过网络上很多其他的解决方案后还是报错,后来就各种检查自己数据库链接有没有出现问题,然后想起来今早电脑重新开机,电脑Ip变了,而之前在程序中写的是电脑的IP地址,改成当前IP就可以,但为通用起见,还是将连接数据库语句中的数据库地址写为“localhost”或者“127.0.0.1”吧。

原创粉丝点击