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 ...
随机推荐
- hadoop13---centos安装jdk
由于各Linux开发厂商的不同,因此不同开发厂商的Linux版本操作细节也不一样,今天就来说一下CentOS下JDK的安装: 方法一:手动解压JDK的压缩包,然后设置环境变量 1.在/usr/目录下创 ...
- Linux 设置中文编码
Linux 设置中文编码 1.测试是否存在字体列表 fc-list 2.安装字体列表包 yum -y install fontconfig 3.去win系统中找到拷贝字体文件. 路径:C:/Windo ...
- 2062326 齐力锋 实验三《敏捷开发与XP实践》实验报告
北京电子科技学院(BESTI) 实 验 报 告 课程: 程序设计与数据结构 班级: 1623 姓名: 齐力锋 学号: 20162326 成绩: 指导教师: 娄嘉鹏/王志强 实验日期: 2017年5月1 ...
- (+4)2.2UML建模图
①用例图 [用途]:帮助开发团队以一种可视化的方式理解系统的功能需求. 用例图所包含的元素如下: 1. 参与者(Actor) 表示与您的应用程序或系统进行交互的用户.组织或外部系统.用一个小人表示. ...
- 转换数据库连接池为hikaricp
hikaricp号称是最快的,今天转换过来试试 1.修改配置文件 <!-- Hikari Datasource --> <bean id="dataSource&quo ...
- Luogu-5004 专心OI-跳房子(矩阵快速幂)
Luogu-5004 专心OI-跳房子(矩阵快速幂) 题目链接 题解: 先考虑最朴素的dp 设\(f[i][0/1]\)表示第\(i\)个位置跳/不跳的方案数,则: \[ \begin{cases} ...
- Android -- 读写文件到内部ROM,SD卡,SharedPreferences,文件读写权限
(内容整理自张泽华教程) 1. 概述 使用文件进行数据存储 首先给大家介绍使用文件如何对数据进行存储,Activity提供了openFileOutput()方法可以用于把数据输出到文件中,具体的实现过 ...
- HashMap和ConcurrentHashMap和HashTable的底层原理与剖析
HashMap 可以允许key为null,value为null,但HashMap的是线程不安全的 HashMap 底层是数组 + 链表的数据结构 在jdk 1.7 中 map集合中的每一项都是一个 ...
- JAVAWEB常见易错问题大汇总
1.如何修改tomcat访问端口? Answer: conf/server.xml 2.如何配置tomcat Manager访问用户? Answer: conf/tomcat-users.xml 主要 ...
- LeetCode第[13]题(Java):Roman to Integer
题目:罗马数字转换 题目难度:easy 题目内容:Roman numerals are represented by seven different symbols: I, V, X, L, C, D ...