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
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.
今天项目中报了如下错误 The last packet sent successfully to the server was 0 milliseconds ago. The driver has n ...
- The last packet sent successfully to the server was 0 milliseconds ago.[nutch---mysql ]
今天在使用JDBC操作mysql时遇到下面的异常信息: 引用 The last packet sent successfully to the server was 0 milliseconds ag ...
- 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 ...
- Communications link failure;;The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure::The ...
- docker 踩坑日记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."的大部分原因是由于数据库回 ...
- 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 milliseconds ago. The driver has not received an ...
- 【异常】The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
1 详细异常信息 The last packet sent successfully to the server was milliseconds ago. The driver has not re ...
- 【错误】:Could not open JDBC Connection for transaction; nested exception is: Communications link failure;The last packet sent successfully to the server was 1 milliseconds ago
# #错误日志 2016-11-10 16:19:20,834 ERROR [org.quartz.core.JobRunShell] - Job DEFAULT.jobtask threw an u ...
随机推荐
- Silverlight应用小知识点
1 Silverlight目录下创建的类 与 根目录下创建的类: 是不同的: Silverlight 不能调用根目录下的类:
- GIT使用—一些概念
(1)Git版本库(repository) 一个简单的数据库,包括所有用来维护与管理项目的修订版本和历史的信息. Git维护两个主要的数据结构: 对象库(object store)-在复制操作时能进行 ...
- Windows 10 安装 到SSD硬盘
1.更换SSD硬盘 2.安装windows 10 系统(升级太慢,建议全新安装) 3.全程不到1个小时个月安装完成. 4.这个分数惨不忍睹,但是速度还是蛮快. 5.挂载机械硬盘,安装驱动,window ...
- 对MySQL数据类型的认识
简述 良好的逻辑设计和物理设计是高性能系统的基石,比如反范式设计可以加快某些类型的查询同时也会影响另外一些类型的查询效率,所以我们必须重视Mysql对于数据库的设计(本文主要讲述表字段类型对于数据库性 ...
- 1163: [Baltic2008]Mafia
1163: [Baltic2008]Mafia Time Limit: 10 Sec Memory Limit: 162 MBSubmit: 123 Solved: 70[Submit][Stat ...
- SFTP无法连接 Connection closed by server with exitcode 127
命令: Pass: ************状态: Connected to 66.77.88.99错误: Connection closed by server with exitcode 127错 ...
- EF Code-First 学习之旅 从已存在的数据库进行Code First
namespace EFDemo { using System; using System.Data.Entity; using System.ComponentModel.DataAnnotatio ...
- Memcached set 命令
Memcached set 命令用于将 value(数据值) 存储在指定的 key(键) 中. 如果set的key已经存在,该命令可以更新该key所对应的原来的数据,也就是实现更新的作用. 语法: s ...
- python学习笔记(session)
昨天提到想加入cookies 测试登录后的接口 尝试了下 只要用 session方法即可 代码如下 #!/usr/bin/env python # -*- coding: utf_8 -*- impo ...
- python 邮件发送实例
#!/usr/bin/env python # -*- coding: utf-8 -*- from email.header import Header from email.mime.text i ...