We had several issues with MySQL connection. Our final stable configuration for the resource is given bellow. As already mentioned above we had added testOnBorrow
, validationQuery
and validationInterval
. But the other issue has appeared which has been fixed with jdbcInterceptors
.
<Resource name="jdbc/ProcessEngine"
auth="Container"
type="javax.sql.DataSource"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
uniqueResourceName="process-engine"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://XXXX:3306/camunda?autoReconnect=true"
username="XXXX"
password="XXXX"
maxActive="20"
minIdle="10"
testWhileIdle="true"
testOnBorrow="true"
testOnReturn="false"
validationQuery="SELECT 1"
validationInterval="30000"
timeBetweenEvictionRunsMillis="30000"
maxWait="10000"
removeAbandonedTimeout="60"
removeAbandoned="true"
logAbandoned="true"
minEvictableIdleTimeMillis="30000"
connectionTimeout="300000"
jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;
org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer;
org.apache.tomcat.jdbc.pool.interceptor.ResetAbandonedTimer"
/>