The last packet successfully received from the server was 78,682,686 milliseconds ago

The last packet successfully received from the server was 78,682,686 milliseconds ago.  The last packet sent successfully to the server was 78,682,686 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.


这个问题通俗的讲是这样的mysql配置里面有个wait_timeout( show global variables like 'wait_timeout';) 这个值表示的是connection允许的最大空闲时间,一个connection空闲时间超过了这个值就会被销毁。如果你使用的连接池允许的最大空闲时间大于mysql的最大空闲时间就会出现mysql把这个连接销毁了而连接池这边还保留着这个连接,当有请求的时候连接池用这个连接的时候就会报这个错误。


所以解决这个问题的办法就是保证连接池这边的connection比mysql那边先过期。

c3p0配置:


<property name="maxIdleTime" value="28700" /> <!-- 这个值要小于mysql的wait_timeout默认值28800 -->



其他的自己琢磨。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值