国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數據庫 > MySQL > 正文

Mysql autoReconnect 問題com.mysql.jdbc.CommunicationsException

2024-07-24 12:58:41
字體:
來源:轉載
供稿:網友
前段時間使用Hibernate + MySQL遇到了這個問題com.mysql.jdbc.CommunicationsException : 。。。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. , x q  

     查了一下終于解決了這個問題,原來是mysql超時設置的問題

具體解決方法:

方法一:使用hibernate 修改Hibernate.cfg.xml加入一下參數

  <property name="connection.autoReconnect">true</property> rVQw  
  <property name="connection.autoReconnectForPools">true</property> CwvgnlI?  
  <property name="connection.is-connection-validation-required">true</property> 42LtkTOw   

方法二:不是也hibernate  修改數據庫連接參數

  數據庫連接參數中加入autoRcConnect=true

   connection url加參數: autoReconnect=true =h6yD*%  

方法三:是也C3P0

  <property name="hibernate.c3p0.acquire_increment">1</property> ba,oxjR/a  
  <property name="hibernate.c3p0.idle_test_period">0</property> jUTE)lO&}  
  <property name="hibernate.c3p0.timeout">0</property> ]g11Q^3;  
  <property name="hibernate.c3p0.validate">true</property>

這樣就可以解決問題。



本文來自CSDN博客,轉載請標明出處:http://blog.csdn.net/zm12037/archive/2009/12/30/5109240.aspx
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 裕民县| 班玛县| 梅河口市| 泌阳县| 通城县| 英德市| 连城县| 达州市| 深泽县| 会东县| 松江区| 都安| 彰武县| 平潭县| 巨鹿县| 工布江达县| 长垣县| 福建省| 宜兴市| 香港 | 龙泉市| 乌拉特后旗| 建宁县| 泽普县| 东平县| 金塔县| 南安市| 浪卡子县| 永吉县| 阿图什市| 靖江市| 石门县| 怀宁县| 海伦市| 钦州市| 梅州市| 阿荣旗| 左贡县| 泸定县| 和林格尔县| 乌鲁木齐县|