Messages:
1. Software caused connection abort: recv failed
2. Communications link failure The last packet successfully received from the server was 2,174,468 milliseconds ago. The last packet sent successfully to the server was 7 milliseconds ago.
3. could not execute query
File: org/hibernate/exception/SQLStateConverter.java
Line number: 99
原因分析:
造成该异常的原因是因为连接池中的连接已经超时失效,而程序在使用该连接的时候没有去检测该连接是否有效。
解决方案:
1、修改mysql的超时等待时间:
2、修改c3p0的配置,使程序在使用连接池之前对连接进行检测,如果无效,则重新获取连接。
例子: