1
回答
使用BoneCP出现的一个错误,请帮忙
滴滴云服务器,限时包月0.9元,为开发者而生>>>   

java.sql.SQLException: The last packet successfully received from the server

was 11,892,590 milliseconds ago.  The last packet sent successfully to

the server was 11,892,608 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. 

我的jdbcurl已经写了autoReconnect=true,这个错误有时出,有时不出现,使用其它的连接池还未发现总是,哪位碰到过?

举报
zhuzhangsuo
发帖于7年前 1回/746阅
共有1个答案 最后回答: 7年前

第一种解决方案

<property name="testWhileIdle" value="true" />
        <property name="timeBetweenEvictionRunsMillis" value="3600000" />
        <property name="validationQuery" value="select 1" />

第二种解决方案

修改mysql的 my.cfg文件,

interactive_timeout = 24000
wait_timeout = 24000
max_connections = 200
connect_timeout=3000

这些都设置长些

另外,这些和bonecp无关,不要怪罪到人家头上

顶部