• FEATURES
  • PRICING
  • MARKETPLACE
  • CASE STUDIES
  • BLOG
  • Tomcat timing out MySQL connection

    We were having issues with tomcat disconnecting from MySQL after a period of inactivity. Traced it to our MySQL instance having a interactive_timeout set to 8 hours (28800 second). Instead of changing MySQL’s timeout I set tomcat to send a validation query every 28760 seconds.

    The following is what I added to conf/contect.xml

        timeBetweenEvictionRunsMillis="28700"
        minEvictionIdleTimeMillis="28750"
        validationQuery="SELECT 1"
        validationInterval="28760"
        testOnBorrow="true"
        removeAbandoned="true"
        removeAbandonedTimeout="55"

    Hi @John_Reber,

    Thanks for updating us about this issue.

    The 8 hour wait time is quite long and could differ from instance to instance. We will check out the ideal wait time and include this configuration in the default tomcat itself so that others won’t face this issue.

    ~Nitesh