We're trying to use MySQL 5.7 backend for JDBC persistent store. This works fine, until the point where the connection goes stale due to the server timeout. This is our current set up in broker.xml:
<store> <database-store> <jdbc-connection-url>jdbc:mysql://xxx:3306/artemis_datasource?create=true&user=mq_admin&password=abcd&useSSL=false&autoReconnect=true&tcpKeepAlive=true&autoReconnectForPools=true</jdbc-connection-url> <bindings-table-name>BINDINGS_TABLE</bindings-table-name> <message-table-name>MESSAGE_TABLE</message-table-name> <page-store-table-name>P_MSG_TBL</page-store-table-name> <large-message-table-name>LARGE_MESSAGES_TABLE</large-message-table-name> <node-manager-store-table-name>NODE_MANAGER_TABLE</node-manager-store-table-name> <jdbc-driver-class-name>com.mysql.cj.jdbc.Driver</jdbc-driver-class-name> </database-store> </store> MySQL default setting of the *wait_timeout* parameter is 8 hours. We are not able to get Artemis to reconnect again after this timeout is reached and we were forced to set up a cron-triggered restart to mitigate this. Error that we get is as follows: *The last packet successfully received from the server was 43417 seconds ago.The last packet sent successfully to the server was 43417 seconds ago, which 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 * This issue is easily rectifiable in the old ActiveMQ, as this uses Spring-cofngiured datasource, e.g.: <bean id="mysql-ds" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.cj.jdbc.Driver"/> <property name="url" value="jdbc:mysql://xxx:3306/mq_datasource?useSSL=false"/> <property name="username" value="user"/> <property name="password" value="pass"/> <property name="poolPreparedStatements" value="true"/> <property name="initialSize" value="5"/> <property name="maxIdle" value="10"/> <property name="maxTotal" value="50"/> <property name="removeAbandonedOnMaintenance" value="true"/> <property name="removeAbandonedOnBorrow" value="true"/> </bean> The *autoReconnect* / *autoReconnectForPools* parameters to the driver URL did not make any difference, and in addition they are not actually recommended by MySQL maintainers. -- Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html