Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Hikari Connection Pool Snippet

DZone's Guide to

Hikari Connection Pool Snippet

A solid high-performance JDBC connection pool at last.

· Java Zone ·
Free Resource

How do you break a Monolith into Microservices at Scale? This ebook shows strategies and techniques for building scalable and resilient microservices.

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’


How do you break a Monolith into Microservices at Scale? This ebook shows strategies and techniques for building scalable and resilient microservices.

Topics:
java ,connection pool ,jdbc

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}