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为例:

第一种解决办法,就是将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

时间: 2024-11-06 20:19:55

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 driver has not received any packets from the server. (关于jdbc)

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. 今天操作数据库较大数据库访问量的时候出现问题,大致是数据库连接缓冲池的问题,弄了半天的mysql (ubuntu). 解决办法: (1)使用JDBC URL中使用autoReconnect属性,url添加 &autoReconnect=tru

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server

? 版权声明:本文为博主原创文章,转载请注明出处 1.问题描述 搭建SSH框架,启动时报错如下: The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. at sun.reflect.GeneratedConstructorAccessor17.newInstance(Unknown Source

The last packet successfully received from the server was 20,519 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago.

本地升级了下MySQL的版本,从5.6升为5.7,数据文件直接拷贝的,项目查询数据库报错: Could not retrieve transation read-only status server The last packet successfully received from the server was 20,519 milliseconds ago.  The last packet sent successfully to the server was 0 milliseconds

he last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.new

mysql重连,连接丢失问题:The last packet sent successfully to the server was……

1.log错误日志: -org.hibernate.exception.JDBCConnectionException: The last packet successfully received from the server was 51,999,860 milliseconds ago. The last packet sent successfully to the server was 51,999,860 milliseconds ago. is longer than the se

MySQL Server 5.0–安装及配置/MySQLInstanceConfig.exe用法详解

MySQL Server 5.0–安装及配置/MySQLInstanceConfig.exe用法详解 http://blog.csdn.net/feihong247/article/details/7791105 配置MySQL步骤: 1.       运行MySQL Server安装目录下bin/MySQLInstanceConfig.exe.出现如下所示的向导界面 . 点击"Next"进入下一步. 2.       如果MySQLInstanceConfig在MySQL Serve

Adobe/Flash Media Server 5.0 linux 64位系统下的安装

一.下载 Adobe/Flash MS5.0下载地址: http://fs1.d-h.st/download/00036/VOt/adobemediaserver_5_ls1_linux64.tar.gz # ./wget http://fs1.d-h.st/download/00036/VOt/adobemediaserver_5_ls1_linux64.tar.gz 二.安装 # ./tar -xvf adobemediaserver_5_ls1_linux64.tar.gz # ./cd

CentOS 7上安装Zabbix Server 3.0 图文详解

转载自 http://www.linuxidc.com/Linux/2016-09/135204.htm CentOS 7上安装Zabbix Server 3.0 图文详解 1.查看系统信息. cat /etc/RedHat-releaseCentOS Linux release 7.0.1406 (Core) uname -a Linux VM_96_155_centos3.10.0-123.el7.x86_64 #1 SMP Mon Jun 30 12:09:22 UTC 2014 x86_

错误号码2003 Can't connect to MySQL server 'localhost' (0)

错误描述 错误原因 最近,我一直都可以用SQLyog连接本地数据库,但是近几天却无法连接:并且一直都报上述错误,我查阅了很多资料,发现有很多中说法 总结一下 第一,MySQL中的my.ini出错: 第二,权限不够: 第三,可能是修改了MySQL自带的User表: 第四,MySQL服务停止了 解决办法 针对上面几种原因,我也做了尝试,发现还是报这个错误: 后来,我将MySQL重装了,再次用SQLyog连接本地数据库,结果成功连接上了. 版权声明:本文为博主原创文章,未经博主允许不得转载. 错误号码