The application is likely still using the JDBI DAOs. The database configuration for the JDBI DAOs is contained in the
JdbiConnectionFactory class in the
Uncomment the 3 lines of code that are currently commented out. These are the settings for H2.
Comment out the 3 lines of code that are the settings for PostgreSQL.
While were are here, let's examine this class a bit.
Both sets of settings have a JDBC URL. This is how we tell JDBC where to find the database.
The JDBC URL for H2 has a lot of options appended to it. These options put H2 into PostgreSQL compatibility mode. Remember earlier how we mentioned that a quirk of PostgreSQL is that it returns result sets that have lowercase column names? H2 (and most other DBMSs) uses uppercase column names in the result set. We don't want to have to rewrite all of the code to use uppercase column names, so we make H2 behave like PostgreSQL --- it will now use lowercase column names.
There is a bunch of code that refers to Hikari. Hikari is a JDBC connection pool. It can take a decent amount of time for an application to connect to a remote database --- enough time that the user is going to notice the system stutter each time a new connection needs to be made. Hikari solves that problem by creating a pool of reusable connections when the database is first accessed. It creates them all in parallel so that the user doesn't have to wait very long for this to happen.
Once the pool is created the application can get connections from the pool instantaneously --- no more stutters.