by BehindJava

How to resolve java.sql.SQLTransientConnectionException HikariPool-6 - Connection is not available, request timed out after 30000ms. SpringBoot

Home » springboot » How to resolve java.sql.SQLTransientConnectionException HikariPool-6 - Connection is not available, request timed out after 30000ms. SpringBoot

In this tutorial we are to learn about resolving the java.sql.SQLTransientConnectionException: HikariPool-6 - Connection is not available, request timed out after 30000ms in Spring Boot.

In springboot, you can set spring.datasource.hikari.leak-detection-threshold=10000 (in milliseconds) in application.properties.

And the default value for maximumPoolSize is 10. You can change it with

spring.datasource.hikari.maximum-pool-size=xx

The reason is database server is running out of connection. Default value for property maximumPoolSize in Hikari is 10. That means it will try to create 10 connection on server startup and it will not start if not able to acquire 10 connection or may fail if your db server pool size having less connection in the pool as you are creating using Hikari configuration.

If you are able to start Spring Boot server and then facing this issue then try enabling leakDetectionThreshold and check which connection is taking more time and not returning to Hikari pool .

spring:
  datasource:        
    hikari:                    
      leak-detection-threshold: 2000