1 year ago

#385811

test-img

hudi

Hikari with Postgress datasource

What is the correct way to define hikari datasource in spring boot application ? We are using this which works but I am not sure what PG datasource is used

datasource.test.jdbcUrl=url
datasource.test.username=username
datasource.test.password=pass
datasource.test.driver-class-name=org.postgresql.Driver
datasource.test.connection-test-query=SELECT 1
datasource.test.maximum-pool-size=5

with

HikariConfig config = new HikariConfig(props);
HikariDataSource ds = new HikariDataSource(config);

according to hikari README they are using ds with properties:

Properties props = new Properties();
props.setProperty("dataSourceClassName", "org.postgresql.ds.PGSimpleDataSource");
props.setProperty("dataSource.user", "test");
props.setProperty("dataSource.password", "test");
props.setProperty("dataSource.databaseName", "mydb");
...

where is defined PG datasource.

Is there any different between this two definition or I should used second one which is in Hikari wiki ? First one also use PGSimpleDataSource ?

spring-boot

hikaricp

0 Answers

Your Answer

Accepted video resources