I'm using the Tomcat JDBC Connection Pool (which is the Spring Boot default) to manage connections to my PostgreSQL cluster, and I just noticed that the pool is created only when the very first query is made. My question is twofold:
- Is there any elegant way to force the pool to be created eagerly (ie, when starting the application)? I believe that executing a simple query upon startup would do the trick, but I'd prefer a more elegant way if available.
- During one of my tests I used
iptables
to drop all traffic directed at the PostgreSQL cluster. This caused the first query to last for about 127 seconds before failing with the messageUnable to create initial connections of pool
. 127 seconds is way too much. Is there any way I can set a lower value for the timeout? I've read the docs but could not conclude much.