1. 程式人生 > >MySQL資料庫提示:Communications link failure,The last packet succe

MySQL資料庫提示:Communications link failure,The last packet succe

Last modified:2013-10-08 14:16:47
     **********************************************
      web網站使用MySQL資料庫,今天突然報以下錯誤:

      Communications link failure,The last packet successfully received from the server was *** millisecond ago.The last packet successfully sent to the server was ***  millisecond ago。

      原因:
      Mysql伺服器預設的“wait_timeout”是8小時(也就是預設的值預設是28800秒),也就是說一個connection空閒超過8個小時,Mysql將自動斷開該connection,通俗的講就是一個連線在8小時內沒有活動,就會自動斷開該連線。而連線池卻認為該連線還是有效的(因為並未校驗連線的有效性),當應用申請使用該連線時,就會導致上面的報錯。

      wait timeout的值可以設定,但最多隻能是2147483,不能再大了。也就是約24.85天。

      修改方法:MySQL通過my.ini 在

      # The TCP/IP Port the MySQL Server will listen on
      port=3306下面新增
      # this is myown dinifition for mysql connection timeout
      wait_timeout=31536000
      interactive_timeout=31536000

      以上是在網上找到的解決方法,但是一般連線的有效時間不用修改,後來分析了以下問題,發現是由於資料庫連線池的一句配置引發的:

Xml程式碼
    <!-- 最大空閒時間,60秒內未使用則連線被丟棄。若為0則永不丟棄。Default: 0 -->   
    <property name="maxIdleTime" value="0"></property>  

      由於mysql的連線空閒超過8個小時,所以就關閉了,但是連線池卻永不丟棄連線,認為該連線還是有效的(因為並未校驗連線的有效性),當應用申請使用該連線時,就會導致上面的報錯。

      解決方法將value設定為20。

相關推薦

MySQL資料庫提示Communications link failureThe last packet succe

Last modified:2013-10-08 14:16:47      **********************************************       web網站使用MySQL資料庫,今天突然報以下錯誤:       Communication

Communications link failureThe last packet successfully received from the server was × millisecon..

        具體解釋是這樣的:Mysql伺服器預設的“wait_timeout”是8小時【也就是預設的值預設是28800秒】,也就是說一個connection空閒超過8個小時,Mysql將自動斷開該connection,通俗的講就是一個連線在8小時內沒有活動,就會自動

MySQL異常【資料庫斷開連線】Communications link failure

一,異常資訊以及解決辦法 com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:Communications link failure org.springframework.transaction.CannotCreateTransa

java工程連線遠端MySQL資料庫報錯Communications link failure due to underlying exception

在開發專案工程時,工程之前都是連線到區域網的測試資料庫,執行沒有問題。但是由於需要將專案部署到外網的伺服器上,同時mysql資料庫也是搭建在外網的伺服器上,當進行本地開發時,由於電腦是連線在本地的區域網內,需要連線到外網的資料庫上,於是就遇到了問題:com.mysql.jdb

MyEclipse中報錯Communications link failure due to underlying exception

問題描述:原來MySql可以正常使用,裝上oracle之後,訪問後臺突然報錯,報錯為:Communications link failure due to underlying exception,具體為: 然後使用MySql檢視工具檢視MySql連線情況,連線是報錯:20

應用端連線MySQL資料庫Communications link failure

事情的起因: 某專案的開發同學突然Q我們組的某同學,要求我們調整MySQL的連線等待超時引數wait_timeout。要求我們從28800s調整到31536000s(也就是一年) 應用端測試環境的tomcat報錯日誌如下圖:   恩。報錯很明顯。這個問題百度後的解決方案

連結資料庫報錯(Communications link failure)之解決篇

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet

資料庫連結斷開 Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

報錯資訊如下: Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsExc

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

啟動 exception fail 空格 jdbc bsp 回車 數據 實現 報錯:com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure 很尷尬的問題,翻譯一

com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

最近在空閒時間學習的時候,往伺服器上部署專案遇到無法連線資料庫,啟動報錯的問題,最後排查下來是一個簡單的配置造成的,特此記錄。 伺服器:centos 7 mysql:5.7.23 tomcat:8.5.34 jdk:1.8.0_181 說明:由於是自己練手的專案

mysql資料庫用ip地址連線時報錯1130-host . is not allowed to connect to this MySql server,MySQL

解決方法:授權法。 例如,你想myuser使用mypassword從任何主機連線到mysql伺服器的話。 GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT O

mysql資料庫show tables 顯示錶名但是查詢的時候卻提示此表不存在

這個問題今天弄了一整天,一直沒有解決,網上搜了好多解決方案,但都沒有用! 報錯如下: ERROR 1146 (42S02): Last_Error: Error 'Table 'mysqldb.frm_auditLog' doesn't exist' Error " ERROR 1146 (42S02):

Oozie時出現Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

  不多說,直接上乾貨!   問題詳情 [[email protected] oozie-4.1.0-cdh5.5.4]$ bin/ooziedb.sh create -sqlfile oozie.sql -run DB Connection [[email&#

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure 解決辦法

09:00:30.307 [http-8080-6] ERROR org.hibernate.transaction.JDBCTransaction -JDBC begin failed com.mysql.jdbc.exceptions.jdbc4.Communicati

Error: Java.lang.RuntimeException: java.lang.RuntimeException: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

tel -- 版本 erro cit nio bsp ip地址 cto 我在用sqoop把數據從mysql導入到hive的過程中遇到報錯Error: Java.lang.RuntimeException: java.lang.RuntimeException: com.my

mysql重連連接丟失The last packet successfully received from the server

sts one rac name java nes over href deb 原文地址:http://nkcoder.github.io/blog/20140712/mysql-reconnect-packet-lost/ 1.1 錯誤信息: Caused by: com

Communications link failure

兩個 lur 發現 idle style mem lec 針對 .cn 針對數據庫Communications link failure的錯誤,可以理解為有兩種策略解決: 策略1(推薦): 數據池配置 <property name="minEvictableI

Cannot create PoolableConnectionFactory (Communications link failure The last packet sent successfu

全部 rip iteye toolbar 登錄 技術分享 方案 onf 17. SQL: Cannot create JDBC driver of class ‘‘ for connect URL 使用數據庫數據源的web 項目,發布後,訪問數據庫500報錯: 瀏覽器端:

支付寶 支付寶掃描生成的二維碼提示碼已失效請重新整理二維碼後重試

問題描述: 開發過程中整合支付寶支付是掃描生成的二維碼提示:二維碼失效? 1 最近在做支付寶電腦網站支付開發時,使用官方sdk執行後,掃描生成的付款二維碼提示:碼已失效,請重新整理二維碼後重試。 導致這種錯誤的原因是我們使用了正式環境的支付寶APP掃描的沙箱環境下的付款二維碼  解決辦

mysql資料庫的簡單增刪改查合併欄位拼接字元操作用java完成將一張表中的查詢結果合併存入另一張表的指定欄位

首先問題描述:我現在有兩個表,一個表是關鍵詞,一個表是含有關鍵詞的標籤,需要做的就是在關鍵詞表中新建一個標籤欄位,把包含該關鍵詞的全部標籤存入其中。比如關鍵詞是Java,標籤可能有Java開發,Java後臺等。我這裡關鍵詞有4000個,標籤有40000個,我用了小段java程式碼+sql的函式就完成