I have a spring-boot application on the same host as the Maria DB and both are running fine for some time. But between 12 hours and 2 days it seems that the spring boot appl
To elaborate on @user5101998's answer and update the other ones, autoReconnect
is actually not recommended. From the connector documentation:
The use of this feature is not recommended, because it has side effects related to session state and data consistency when applications don't handle SQLExceptions properly, and is only designed to be used when you are unable to configure your application to handle SQLExceptions resulting from dead and stale connections properly
The test-on-borrow
property makes your provider (Tomcat, Hikari, etc.) tests that the connection is valid before fetching it from the connection pool.
The validate-query
is what will be used to ensure that the connection is valid.
Using these parameters should prevent Spring from using dead connections. For Tomcat for instance, you can find documentation here on these parameters.