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

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

          描述:
             
              用jpa(hibernate實(shí)現(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)沒有進(jìn)行數(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)

          主站蜘蛛池模板: 阿克苏市| 临桂县| 井研县| 延川县| 灵璧县| 周口市| 永春县| 郓城县| 武川县| 新郑市| 康马县| 定兴县| 大荔县| 工布江达县| 旺苍县| 曲松县| 襄垣县| 太和县| 曲阜市| 富顺县| 壤塘县| 麻栗坡县| 贡嘎县| 田东县| 红安县| 探索| 宜君县| 蒲江县| 财经| 宝兴县| 胶南市| 万全县| 阳曲县| 安乡县| 同德县| 古田县| 兴山县| 永善县| 杭锦旗| 和林格尔县| 广灵县|