Communications link failure
来源:互联网 发布:福建师范大学软件学院 编辑:程序博客网 时间:2024/05/26 05:51
今天遇到一个关于数据方面的问题,问题如下:
StatementCallback; SQL [UPDATE 。。。WHERE id= 35]; Communications link failure
Last packet sent to the server was 18896 ms ago.; nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
Last packet sent to the server was 18896 ms ago.
原因及解决方法:
Mysql服务器默认的“wait_timeout”是8小时,也就是说一个connection空闲超过8个小时,Mysql将自动断开该connection。这就是问题的所在,在C3P0 pools中的connections如果空闲超过8小时,Mysql将其断开,而C3P0并不知道该connection已经失效,如果这时有Client请求connection,C3P0将该失效的Connection提供给Client,将会造成上面的异常。
解决的方法:
1、增加wait_timeout的时间。
修改方法:MySQL通过my.ini 在
# this is myown dinifition for mysql connection timeout
wait_timeout=31536000
2、修改xml配置
<!--最大空闲时间,60秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 -->
<property name="maxIdleTime" value="0" />
由于mysql的连接空闲超过8个小时,所以就关闭了,但是连接池却永不丢弃连接,认为该连接还是有效的(因为并未校验连接的有效性),当应用申请使用该连接时,就会导致上面的报错。所以重新设置value值
- Communications link failure
- Communications link failure
- mysql: Communications link failure
- Communications link failure
- Communications Link failure
- Communications link failure
- CommunicationsException: Communications link failure
- Communications link failure
- mysql Communications link failure
- Communications link failure
- Communications link failure
- Communications link failure
- Communications link failure
- Communications link failure的解决办法
- mysql: Communications link failure解决
- Communications link failure错误分析
- Communications link failure的解决办法
- mysql: Communications link failure解决
- 面试记录第二十节——(MVP讲解)
- 最新版管家婆辉煌版普及版II TOP+ V12.71单机、网络、门店破解
- C# 导出 Excel 和相关打印设置
- git 操作的一些方式
- 使用Apache的ab工具进行压力测试
- Communications link failure
- redis的持久化--快照持久化(SNAPSHOTTING)
- sort
- Android启动定时任务
- spring cloud+dotnet core搭建微服务架构
- MySQL优化,索引和索引的使用和检测索引是否有效
- Shader Alpha混合
- 关于NanoPi NEO(全志H3)平台下的LEDE(openWRT)系统的编译(分色排版)(不知道怎么烧录)
- MySQL主从复制与主主复制