0
Hi, I’m trying to manually set up a connection pool with Hikari. I will need to do manual because the application will have its dynamic settings for connection to the databases and schemas/Sid.
How I’m setting up the connections:
HikariConfig configHikari = new HikariConfig();
configHikari.setUsername("username");
configHikari.setPassword("password");
configHikari.setJdbcUrl("url");
configHikari.setDriverClassName("driver");
HikariDataSource dataSource = new HikariDataSource(configHikari);
I am managing to use the connections, but after some time, I have the following error below:
16:31:44.044 WARN com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Failed to validate connection oracle.jdbc.driver.T4CConnection@5111dd1a (IO Error: Invalid Operation, NOT Connected). Possibly consider using a shorter maxLifetime value.
16:31:49.049 WARN com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Failed to validate connection oracle.jdbc.driver.T4CConnection@703110b7 (IO Error: Invalid Operation, NOT Connected). Possibly consider using a shorter maxLifetime value.
16:31:54.054 WARN com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Failed to validate connection oracle.jdbc.driver.T4CConnection@555f60aa (IO Error: Invalid Operation, NOT Connected). Possibly consider using a shorter maxLifetime value.
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 30170ms.
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:82)
I tried to increase the max-life-time of Hikari, but after a while I have the same mistake.
configHikari.setMaxLifetime(600000);
What do I need to set up for the connection to reconnect? Is there any infinite max-life-time? and is it healthy to have a very large max-life-time? I have not yet tested in the other banks to see if I am having the same error, for now I tested only in oracle and already got this problem.
And right now I have to be re-starting the app when that time wins.
Related (Soen): https://stackoverflow.com/q/28180562/2241463
– Piovezan