Hibernate+MySQL連接超時解決辦法。
hibernate.PRoperties中的配置如下:
#數據庫驅動
hibernate.connection.driver_class = com.mysql.jdbc.Driver#數據庫連接的URLhibernate.connection.url = jdbc:mysql://localhost:3306/db_123456#用戶名hibernate.connection.username = root#密碼hibernate.connection.passWord =root#是否顯示SQL語句hibernate.show_sql=true#Hibernate方言hibernate.dialect =org.hibernate.dialect.MySQLDialect#最小連接數hibernate.c3p0.min_size=5#最大連接數hibernate.c3p0.max_size=20#獲得連接的超時時間,如果超過這個時間,會拋出異常,單位毫秒hibernate.c3p0.timeout=1800#最大的PreparedStatement的數量hibernate.c3p0.max_statements=50#設為true那么在取得連接的同時將校驗連接的有效性hibernate.c3p0.testConnectionOnCheckout=true新聞熱點
疑難解答