2011-12-13 82 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