Database Connections Timing Out (Connection Pooling On Tomcat)
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/开发者_JAVA技巧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
精彩评论