两种解决异常:“The last packet sent successfully to the server was 0 milliseconds ago. ”的办法
来源:互联网 发布:淘宝发的10元现金红包 编辑:程序博客网 时间:2024/06/09 15:59
出现异常”The last packet sent successfully to the server was 0 milliseconds ago.“的大部分原因是由于数据库回收了连接,而系统的缓冲池不知道,继续使用被回收的连接所致的。
以mysql为例:
第一种解决办法,就是将mysql回收空闲连接的时间变长,mysql默认回收时间是8小时,可以在mysql目录下的my.ini中增加下面配置,将时间改为1天。
单位是秒,最大好像是24天:
[mysqld]
wait_timeout=86400
第二种解决办法,可以通过配置,让缓冲池去测试连接是否被回收,如果被回收,则不继续使用,以dbcp为例:
#SQL查询,用来验证从连接池取出的连接
dbcp.validationQuery=SELECT 1
#指明连接是否被空闲连接回收器(如果有)进行检验,如果检测失败,则连接将被从池中去除
dbcp.testWhileIdle=true
#在空闲连接回收器线程运行期间休眠的时间值,以毫秒为单位,一般比minEvictableIdleTimeMillis小
dbcp.timeBetweenEvictionRunsMillis=300000
#在每次空闲连接回收器线程(如果有)运行时检查的连接数量,最好和maxActive一致
dbcp.numTestsPerEvictionRun=50
#连接池中连接,在时间段内一直空闲,被逐出连接池的时间(1000*60*60),以毫秒为单位
dbcp.minEvictableIdleTimeMillis=3600000
- 两种解决异常:“The last packet sent successfully to the server was 0 milliseconds ago. ”的办法
- 两种解决异常:“The last packet sent successfully to the server was 0 milliseconds ago. ”的办法
- [Java] 解决异常:“The last packet sent successfully to the server was 0 milliseconds ago.
- The last packet sent successfully to the server was 0 milliseconds ago问题的解决
- 异常The last packet sent successfully to the server was 0 milliseconds ago...
- 【MySql】数据库连接异常:The last packet sent successfully to the server was 0 milliseconds ago
- The last packet sent successfully to the server was 0 milliseconds ago. 的解决办法
- The last packet sent successfully to the server was 0 milliseconds ago. The
- The last packet sent successfully to the server was 0 milliseconds ago.
- The last packet sent successfully to the server was 0 milliseconds ago.
- The last packet sent successfully to the server was 0 milliseconds ago.
- java mysql The last packet sent successfully to the server was 0 milliseconds ago.
- The last packet sent successfully to the server was 0 milliseconds ago.
- The last packet sent successfully to the server was 0 milliseconds ago.
- The last packet sent successfully to the server was 0 milliseconds ago
- Communications link failure:The last packet sent successfully to the server was 0 milliseconds ago.
- mysql 连接出现The last packet sent successfully to the server was 0 milliseconds ago.问题解决
- The last packet sent successfully to the server was 0 milliseconds ago.
- 想成为软件架构师,你的举止够优雅吗?
- 发现一个很不错的NHibernate的教程《NHibernate之旅》来自:李永京先生
- ExtJs学习系列(2)--Ext.Panel
- .net里控制SQL服务启动
- LVS集群的负载调度
- 两种解决异常:“The last packet sent successfully to the server was 0 milliseconds ago. ”的办法
- 有关生活的碎碎念
- 电信运营商云计算战略定位分析
- break和continue区别及使用场合
- ASP.NET的十步学习法——第六步
- 自定义android.jar(包含internel,hide)
- java.lang.OutOfMemoryError: Java heap space
- ExtJs学习系列(1)--Ext.MessageBox
- ASP.NET的十步学习法——第七步 .