2011-12-13 79 views
0

異常的管道中斷的例外是:什麼用C3P0和Hibernate

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was45569 milliseconds ago.The last packet sent successfully to the server was 45569 milliseconds ago, which 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.

回答

1

這意味着應用程序了之間的網絡連接和數據庫被打破。

這可能會發生各種原因(網絡故障或連接超時)。最後的一句話基本上是如何解決這個問題。

您可以嘗試更改設置以使連接不太容易出現故障/斷開連接,或配置JDBC驅動程序來處理故障/斷開連接並自動重新連接。

注意:您不應該直接長時間保持連接。從池中獲取連接,使用它並將其釋放回池中。游泳池爲您管理連接。

+0

例外情況是當天只有一次,即當第一次打到數據庫時。 我假定由於c3p0配置而引發的問題。 如果您有任何解決方案。這將是gretat! – Chandu