首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用c3p0和Hibernate的断开管道异常是什么

问使用c3p0和Hibernate的断开管道异常是什么
EN

Stack Overflow用户
提问于 2011-12-13 18:35:48
回答 2查看 1.3K关注 0票数 0

例外情况是:

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.

EN

回答 2

Stack Overflow用户

发布于 2012-01-02 20:52:07

可能发生的情况是,C3P0池中的连接被MySQL关闭,因为它保持打开的时间比interactive_timeout (http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_interactive_timeout)长

您可能需要配置c3p0来测试连接,如下所示:http://www.mchange.com/projects/c3p0/index.html#configuring_connection_testing

票数 2
EN

Stack Overflow用户

发布于 2011-12-13 18:39:25

这意味着应用程序和数据库之间的网络连接已中断。

发生这种情况的原因有很多(网络故障或连接超时)。最后一句话主要是关于如何解决这个问题。

您可以尝试更改设置以降低连接失败/断开的可能性,也可以将JDBC驱动程序配置为处理失败/断开连接并自动重新连接。

注意:不能长时间保持直接连接。从池中获取连接,使用它,然后将其释放回池中。池为您管理连接。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8487713

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档