Using connection pools such as Hikari or Oracle UCP, you can set pool size (init size, idle size, max size) and timeouts (idle/inactive connection timeout).
In hikari, you can configure keepaliveTime
(combined with long idle tiemout / max life time) to prevent firewall killing idle TCP connections (SQLRecoverableException: Closed Connection
)...
But in Oracle UCP, I did not find option to enable connection "keepalive". So there might be option to set it on jdbc driver level - oracle.net.keepAlive; oracle.net.TCP_KEEPIDLE; oracle.net.TCP_KEEPINTERVAL; oracle.net.TCP_KEEPCOUNT;
Question:
If I enable keepalive on JDBC driver, what happens to pool's idleTimeout
when pool size is bigger than minimumIdle
?
Would the pool drop such connection as "idle" or would it consider "alive" because of keepalive packets and keep it opened?
Thanks
Based on answers, I have decided not to interfere with ojdbc settings and set ucp to validateConnectionOnBorrow=true
, secondsToTrustIdleConnection=1800
to achieve detection of broken connections (because of missing keepalive option in ucp)