JDBCConnectionException "Unable to acquire JDBC Connection" with spring boot
You run out of connections.
Try to set the Hikari Connection Pool to a bigger number:
spring.datasource.hikari.maximum-pool-size=10
I did face the same issues every 2nd day when I was working with jasper reports and finally fixed it by proper understanding because when we work with query based reports we are responsible to close the connection of data source our own so that it return to the pool and available for next use. You have to take care of multiple things 1- get connection from dataSource
DataSourceUtils.getConnection(ds);
2-You must have to close data source connection in any case :better to close it in finally block so that in case of exception connection do not remain open .
finally{closeConnection(con,dataSource);}
public void closeConnection(Connection con,DataSource ds) {
if (con != null) {
DataSourceUtils.releaseConnection(con, ds);
}
}
3-Made changes in application.properties file
spring.datasource.hikari.connectionTimeout=30000
spring.datasource.hikari.idleTimeout=600000
spring.datasource.hikari.maxLifetime=1800000
spring.datasource.hikari.maximumPoolSize=30