In my Spring Boot application does a connection created manually using DriverManager get added to the HikarCP connection pool or not.
I have the following properties for Hikari connection pool:
spring.datasource.hikari.maximum-pool-size=5
spring.datasource.hikari.idle-timeout=30000
spring.datasource.hikari.minimum-idle=1
spring.datasource.hikari.leakDetectionThreshold=240000
spring.datasource.hikari.connectionTimeout=30000
spring.datasource.hikari.maxLifetime=300000
And in one of the classes I'm creating a new connection manually.
try (Connection con = DriverManager.getConnection(url, user, password)) {
try (PreparedStatement stmt = con.prepareStatement(updatedCommand)) {
stmt.execute();
} catch (SQLException sqlException) {
log.error("Error while executing the sql command , message {}", sqlException.getLocalizedMessage());
}
} catch (Exception e) {
log.error("Error while connecting to Database, message {}", e.getLocalizedMessage());
}
Does the manually created connection get added to Hikari's connection pool or not.
If it's added to Hikari's managed connection pool then does it close this connection according the configurations if it sits idle?