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
- Testing connection validity
- 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