簡體   English   中英

jdbc4.CommunicationsException-神秘的超時

[英]jdbc4.CommunicationsException - mysterious timeout

日志消息的全文:

Log Message: An error occurred while grabbing new users com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 44,567,434 milliseconds ago. The last packet sent successfully to the server was 44,567,434 milliseconds ago. 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.

這對我來說很奇怪,因為那要超過10個小時。 在過去的10個小時中,我的程序運行愉快並且成功運行,包括與數據庫進行通信。 我最好的假設是,池中的單個連接是陳舊的,但在那種情況下,我不知道為什么不會自動清除此連接,或者該異常是否與該操作有關。 我該如何處理?

我正在使用c3p0連接池。

c3p0有很多測試連接並防止其超時或過時的方法。 解決您所遇到的特定問題的最簡單方法是將配置參數maxIdleTime設置為8小時(28800秒)。

但是您可能通常想開始測試連接,例如,通過將idleConnectionTest周期設置為經常使用並將testConnectionOnCheckin設置為true。 看到...

http://www.mchange.com/projects/c3p0/#configuring_connection_testing

http://www.mchange.com/projects/c3p0/#configuration_properties

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM