brettwooldridge / HikariCP

光 HikariCP・A solid, high-performance, JDBC connection pool at last.
Apache License 2.0
19.91k stars 2.92k forks source link

[Question] recovery after Oracle database outage - properties to use? #2208

Open endingssss opened 3 months ago

endingssss commented 3 months ago

For our applications we use an Oracle database, and occasionally the connection to the database gets completely lost - network issue, database outage (planned or unplanned), etc. When these issues happen, we end up in the situation where HikariCP isn't able to recover database connectivity automatically, which seems to be the same issue that's been reported various times before (ie: #1056, #2179, #1815, #1736). The recommendation from #1056 is to set the driver's socketTimeout property, with the rest pointing to https://github.com/brettwooldridge/HikariCP/wiki/Rapid-Recovery, which lists PostgreSQL, MySQL, and SQL Server as supporting the socketTimeout property and for the others it says:

Each driver differs in how this timeout is set, but nearly all drivers support it.

From #2179 the suggested solution is to set the oracle.net.CONNECT_TIMEOUT and oracle.jdbc.ReadTimeout connection properties which I found documentation for these at https://docs.oracle.com/en/database/oracle/oracle-database/19/jajdb/oracle/jdbc/OracleConnection.html for CONNECTION_PROPERTY_THIN_OUTBOUND_CONNECT_TIMEOUT and CONNECTION_PROPERTY_THIN_READ_TIMEOUT respectively.

The question: are these the correct properties to set? It sounds like they are, but I'm not an expert and was hoping I could get confirmation before I start using them.