Database Connections Timing Out (Connection Pooling On Tomcat)

旧巷老猫 提交于 2019-12-12 09:11:01

问题


My dB connections are constantly timing out. I looked through some of the solutions people have offered to this, and have implemented them, but nothing has worked out till now. Any new thoughts, will be very helpful.

Problem
For some requests to the webapp, this is the error I am getting :

com.mysql.jdbc.CommunicationsException: The last packet successfully received from the server was 11,198,881 milliseconds ago. The last packet sent successfully to the server was 11,198,881 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.

Solutions Tried

  1. Testing connection validity
  2. Using autoReconnect

Contents of context.xml

Resource name="jdbc/dBConnectionMain" auth="Container" type="javax.sql.DataSource" maxActive="20" maxIdle="18" removeAbandoned="true" removeAbandonedTimeout="60" logAbandoned="true" validationQuery="select 1" testOnBorrow="true" username="user" password="password" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/databaseName?autoReconnect=true" /

Any pointers on this?

Cheers,
RD

来源:https://stackoverflow.com/questions/7095687/database-connections-timing-out-connection-pooling-on-tomcat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!