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

今天操作数据库较大数据库访问量的时候出现问题,大致是数据库连接缓冲池的问题,弄了半天的mysql (ubuntu)。

解决办法:
(1)使用JDBC URL中使用autoReconnect属性,url添加

&autoReconnect=true&failOverReadOnly=false
例如:
String URL = "jdbc:mysql://localhost:3306/mxManage&autoReconnect=true&failOverReadOnly=false";

(2) 修改MySQL的参数. /etc/my.cnf 添加

[mysqld]
wait_timeout=31536000
interactive_timeout=31536000

(3)重启mysql

service mysql restart

原因分析:
(1)大量数据访问情况下,mysql connection连接有可能失效

(2)长时间不妨问,connection会失效

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. (关于jdbc)的更多相关文章

  1. 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 ...

  2. 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 ...

  3. 【异常】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 ...

  4. mysql异常 : The driver has not received any packets from the server.

    异常: 结论:域名写错了或报这个异常

  5. MySql8.0数据库链接报错The driver has not received any packets from the server

    1.我使用MySql数据库8.0版本,然后驱动改成了 jdbc.driver=com.mysql.cj.jdbc.Driver jdbc.url=jdbc:mysql://127.0.0.1:3306 ...

  6. The driver has not received any packets from the server

    解决方法: jdbc的url添加参数: jdbc.url=jdbc:mysql://localhost:3306/totosea?useUnicode=true&characterEncodi ...

  7. 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 ...

  8. 解决异常:“The last packet sent successfully to the server was 0 milliseconds ago. ”的办法

    出现异常"The last packet sent successfully to the server was 0 milliseconds ago."的大部分原因是由于数据库回 ...

  9. 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 ...

随机推荐

  1. 【HDOJ】4983 Goffi and GCD

    题意说的非常清楚,即求满足gcd(n-a, n)*gcd(n-b, n) = n^k的(a, b)的不同对数.显然gcd(n-a, n)<=n, gcd(n-b, n)<=n.因此当n不为 ...

  2. BestCoder Round #49

    呵呵哒,1001的dfs返回值写错,wa了两发就没分了,1002显然是PAM可是我没学过啊!!!压位暴力可不可以...看看范围貌似不行,弃疗...1003根本不会做,1004想了想lcc发现不可做,那 ...

  3. js脚本同步、异步与延迟

    一般,我们通过src引入js文件时建议在页面末尾引入,因为会阻塞页面的渲染.defer和async可以达到同样效果 当HTML解析器遇到<script>元素时,它必须先执行脚本,然后再恢复 ...

  4. java排序算法-归并排序

    public class MergeSort { private static void mergeSortTest() { int[] in = { 2, 5, 3, 8, 6, 7, 1, 4, ...

  5. LA 3485 Bridge

    自适应辛普森公式模板. #include<algorithm> #include<iostream> #include<cstring> #include<c ...

  6. 那些年,学swift踩过的坑

    最近在学swift,本以为多是语法与oc不同,而且都是使用相同的cocoa框架,相同的API,但是或多或少还是有些坑在里,为了避免以后再踩,在这里记下了,以后发现新的坑,也会慢慢在这里加上 [TOC] ...

  7. 05-图2. Saving James Bond - Easy Version (25)

    1 边界和湖心小岛分别算一个节点.连接全部距离小于D的鳄鱼.时间复杂度O(N2) 2 推断每一个连通图的节点中是否包括边界和湖心小岛,是则Yes否则No 3 冗长混乱的函数參数 #include &l ...

  8. cocos2d-x 3.6版连连看载入资源

    网上找了一个梦幻连连看的资源.大家能够百度一下.然后整理一下加到project里面去.包含声音和图片文件.后面解释怎样整理能够方便管理. 我不推荐在代码里面直接引用资源文件名称,我称之为硬编码. 做i ...

  9. Linux crontab 命令详解(含配置文件路径)

    编辑/etc/crontab 文件配置cron cron 服务每分钟不仅要读一次/var/spool/cron内的所有文件,还需要读一次/etc/crontab,因此我们配置这个文件也能运用cron服 ...

  10. 配置本地yum源的方法

    配置本地yum源的方法 1. 挂载光驱 如果是上传iso镜像到服务器上,则直接挂载iso镜像即可: #mount -o loop -t iso9660 /xxxx.iso /挂载目录 开机自动加载#v ...