Hikari Connection Pool

DataSource Configuration in Java:

HikariConfig config = new HikariConfig();
config.setDriverClassName(“org.postgresql.Driver”);
config.setJdbcUrl(postgresqlConfig.getUrl());
config.setUsername(postgresqlConfig.getUser());
config.setPassword(postgresqlConfig.getPassword());
config.setMinimumIdle(postgresqlConfig.getMaxIdle());
config.setMaximumPoolSize(postgresqlConfig.getMaxActive());
config.addDataSourceProperty(“cachePrepStmts”, “true”);
config.addDataSourceProperty(“prepStmtCacheSize”, “250”);
config.addDataSourceProperty(“prepStmtCacheSqlLimit”, “2048”);
return new HikariDataSource(config);

gradle dependency:

compile ‘com.zaxxer:HikariCP:2.4.1’

Written By bunkertor

Leave a Reply

Your email address will not be published. Required fields are marked *