DataSourcePool and validation query | Community
Skip to main content
broman__pl
Level 3
October 16, 2015
Solved

DataSourcePool and validation query

  • October 16, 2015
  • 1 reply
  • 943 views

Hi,
I try to use DataSourcePool to connect with MySQL database. And I notice that after long inactivity or database restart connection is closed and first attempt to use it ends with this error message.

Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 49,803,911 milliseconds ago.  The last packet sent successfully to the server was 49,803,925 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.

I try to define validation query "Select 1" but I don't see any improvements.
Also have autoReconnect=true and autoReconnectForPools=true in connection url
Thanks

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by smacdonald2008

For testing purposes -- try and write your own OSGi bundle to connect to database. See:

http://helpx.adobe.com/adobe-cq/using/creating-cq-web-application-uses.html

http://helpx.adobe.com/adobe-cq/using/querying-persisting-cq-data-mysql.html

I have noticed in the past -- that I have fewer issues when i write my own connection via an OSGi using JDBC APIs. 

1 reply

smacdonald2008
smacdonald2008Accepted solution
Level 10
October 16, 2015

For testing purposes -- try and write your own OSGi bundle to connect to database. See:

http://helpx.adobe.com/adobe-cq/using/creating-cq-web-application-uses.html

http://helpx.adobe.com/adobe-cq/using/querying-persisting-cq-data-mysql.html

I have noticed in the past -- that I have fewer issues when i write my own connection via an OSGi using JDBC APIs.