隨筆 - 0, 文章 - 264, 評論 - 170, 引用 - 0
          數(shù)據(jù)加載中……

          com.mysql.jdbc.exceptions.jdbc4.CommunicationsException||java.net.SocketException: Broken pipe

          描述:
             
              用jpa(hibernate實現(xiàn))做應(yīng)用時,程序中報以下錯誤:
              com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:
              The last packet successfully received from the server was 79,221,885 milliseconds ago.
              The last packet sent successfully to the server was 79,221,885 milliseconds ago.
              is longer than the server configured value of 'wait_timeout'.
              You should consider either expiring and/or testing connection validity before use in your application,
              increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.

          解釋及解決辦法:  :<v?n  
          J:h"5~  
              如果連接閑置8小時 (8小時內(nèi)沒有進行數(shù)據(jù)庫操作), mysql就會自動斷開連接, 得刷新應(yīng)用才行. 7 Wx_z   
              不用hibernate的話, connection url加參數(shù): autoReconnect=true $rJn[ZZpb  
              用hibernate的話, 加如下屬性: 'P67p  
                  <property name="connection.autoReconnect">true</property> dU%nxy0i+  
                  <property name="connection.autoReconnectForPools">true</property> ;d]OEd?"  
                  <property name="connection.is-connection-validation-required">true</property>
          0KjPAR6O  
              要是還用c3p0連接池: VxMBF,  
                  <property name="hibernate.c3p0.acquire_increment">1</property> ;>RS{0\bfB  
                  <property name="hibernate.c3p0.idle_test_period">0</property> $?P?8pt'@  
                  <property name="hibernate.c3p0.timeout">0</property> ,F:pe[  
                  <property name="hibernate.c3p0.validate">true</property>

          posted on 2011-01-17 21:39 小一敗涂地 閱讀(6218) 評論(0)  編輯  收藏 所屬分類: hibernate相關(guān)JPA,EJB相關(guān)

          主站蜘蛛池模板: 辽阳市| 浮梁县| 临夏市| 贺兰县| 老河口市| 丹阳市| 莎车县| 碌曲县| 婺源县| 孟津县| 渝北区| 孝感市| 岑巩县| 博野县| 利川市| 湛江市| 莒南县| 石首市| 安庆市| 青龙| 澄城县| 施甸县| 南丰县| 离岛区| 宁陵县| 榆林市| 浦东新区| 奎屯市| 图们市| 定日县| 稷山县| 蒙山县| 澜沧| 昌乐县| 武定县| 南华县| 宜兰县| 磐石市| 横峰县| 富阳市| 杭锦后旗|