0

I have a SpringBoot app which is connect to a SQL SERVER. It works however after couple of hours the connection is closed and my whole app goes down. I've tried to find how to setup auto reconnect but I found only solutions for MySql. Does anyone know how to do it ? Cheers

EDIT: Stack trace

2018-10-18 01:07:10.346 WARN 14 --- [nio-8080-exec-5] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Failed to validate connection ConnectionID:230 ClientConnectionId: 9d8060c2-016d-4040-a901-fadb5cd4a4c0 (The connection is closed.)
2018-10-18 01:07:40.344 WARN 14 --- [nio-8080-exec-5] o.s.b.a.jdbc.DataSourceHealthIndicator : DataSource health check failed
org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 30000ms.
Clyde Barrow
  • 1,924
  • 8
  • 30
  • 60
  • why does it go down? By the way I think that maybe DBCP will reconnect – Scary Wombat Oct 19 '18 at 07:15
  • I added the most important parts of the stacktrace. Basically after couple of hours it fails jdbc health check because the connection is closed – Clyde Barrow Oct 19 '18 at 07:23
  • The default `maxLifetime` configuration of Hikari is 30 minutes, so normally, connections are already killed after 30 minutes, after which it will create a new one. – g00glen00b Oct 19 '18 at 08:02
  • Seems relevant https://stackoverflow.com/questions/45356565/hikaricp-auto-reconnect – Jens Schauder Oct 19 '18 at 11:28

0 Answers0