There are several ways to configure the Hikari connection pool. All of them are based on the usage of the javax.sql.DataSource interface:
- The most obvious and straightforward method is to set the pool properties on the DataSource object directly:
HikariDataSource ds = new HikariDataSource();ds.setPoolName("cookpool");ds.setDriverClassName("org.postgresql.Driver");ds.setJdbcUrl("jdbc:postgresql://localhost/cookbook");ds.setUsername( "cook");//ds.setPassword("123Secret");ds.setMaximumPoolSize(10);ds.setMinimumIdle(2);ds.addDataSourceProperty("cachePrepStmts", Boolean.TRUE);ds.addDataSourceProperty("prepStmtCacheSize", 256);ds.addDataSourceProperty("prepStmtCacheSqlLimit", 2048);ds.addDataSourceProperty("useServerPrepStmts" ...