问题:通过spring 连接 mysql 会出现报错com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet successfully received from the server was 1,924,852 milliseconds ago. The last packet sent successfully to the server was 4 milliseconds ago.以及
Spring连接mysql长时间空闲报错:The last packet successfully received from the server was xx millisecond ago...
最新推荐文章于 2024-10-12 11:22:40 发布
在Spring连接MySQL时遇到因等待超时导致的CommunicationsException异常。通过修改MySQL配置文件`my.ini`的`wait_timeout`值或者在Spring的`dataSource`配置中使用`validationQuery`和`testOnBorrow`属性来验证和重新建立连接,可以有效解决这个问题。
摘要由CSDN通过智能技术生成