Skip to content
This repository was archived by the owner on Aug 20, 2022. It is now read-only.

Creating a datasource

Florian Fülling edited this page Jul 25, 2022 · 1 revision

Data Source Creator

The DataSourceCreator can be used to build HikariDataScource with a builder pattern.

Choose the correct SqlType for your data source. The methods available in the configuration depend on the SqlType.

class Main {

    public static void main(String[] args) {
        HikariDataSource build = DataSourceCreator.create(SqlType.POSTGRES)
                .configure(builder -> builder
                    .host("localhost")
                    .database("postgres")
                    .port(5432)
                    .user("postgres")
                    .password("root"))
                .create()
                .withMaximumPoolSize(3)
                .withMinimumIdle(1)
                .build();
    }
}

Every value which is not set will be the default value provided by the database driver.

Clone this wiki locally