The HikariCP documentation says:
connectionTimeout: This property controls the maximum number of milliseconds that a client will wait for a connection from the pool. If this time is exceeded without a connection becoming available, a SQLException will be thrown.
Through testing, I see that SQLTransientConnectionException
is thrown in this case.
If my pool is exhausted, I get this exception. If my database host is disconnected from the network, I get this exception. If my database instance service is stopped, I get this exception.
The problem is that whatever the reason, the pool will always throw this exception with the same message.
This way I can't inform the users what is going on. If the pool is really exhausted (a normal thing under heavy load) the user should be informed and asked to try again later.
But if my database server is down, It's a different story, and the user should be informed accordingly.