HikariCP connectionTimeout vs idleTimeout
Fast recall
Quick revision
Core answer
Whether you can distinguish borrow-wait timeout from idle-retirement timeout.
Confusing the two, or thinking idleTimeout affects active connections.
Note idleTimeout only applies above minimumIdle; connectionTimeout drives the exhaustion error.
Interview-ready guide
Interview answer
If all ten connections are borrowed and another caller waits longer than connectionTimeout, Hikari throws a SQLTransientConnectionException. If maximumPoolSize is ten and minimumIdle is two, idleTimeout can retire unused connections above two after demand falls. If minimumIdle is left at Hikari's default of the maximum, all ten belong to the minimum and idleTimeout does not shrink the pool. This condition is essential to the comparison.
For example, a busy pool can make a checkout wait until connectionTimeout and then fail. idleTimeout instead retires eligible idle connections above minimumIdle, so it is not a query timeout or an active-connection lifetime.
HikariCP connectionTimeout vs idleTimeout
Direct Answer
connectionTimeout is the maximum time a caller waits for an available pool connection before getConnection fails. idleTimeout controls retirement of surplus idle connections only when minimumIdle is lower than maximumPoolSize. It does not retire connections below minimumIdle, and retirement timing is approximate. Hikari's documented defaults are 30 seconds and 10 minutes respectively.
Common Mistakes & Pitfalls
Confusing the two, or thinking idleTimeout affects active connections.
Check your understanding
Answer these without looking back at the article.
- Does idleTimeout affect active connections?
- Which setting controls the pool-exhaustion error?
- How does idleTimeout interact with minimumIdle?
Looking for a structured roadmap?
Every module on this page is also part of the full Java backend interview track.