I'm using Spring Boot with the following application.properties
file for my database setup:
spring.datasource.url=jdbc:mysql://<my heroku cleardb host...>/<my db>
spring.datasource.username=<some user...>
spring.datasource.password=<some pass...>
spring.datasource.driverClassName=com.mysql.jdbc.Driver
I'm hosting my site on Heroku with ClearDB MySQL Database. My app keeps getting disconnected from the MySQL DB and it's because of this (from their support team):
To jump in here about this issue - the reason is that our systems automatically close all idle connections after 90 seconds of inactivity. This could be the reason you are running into this issue, especially if your connection pool is not properly configured to "ping" connections in less than around 90 seconds. Our recommendation would be to set the connection pool configuration to ping all pooled connections once every 60 seconds for safe keeping.
So the question is...how can I "ping" my connections every 60 seconds? I would like to believe that there is a way to set a spring.datasource
property to do this but I'm having trouble finding a 'ping' property.