I'm trying to configure HikariCP datasource in Spring @Configuration class[Database being oracle]. But it's not working.
I searched in the internet and found that HikariCP datasource needs to be configured with constructor. I have tried this [the way it's mentioned in their github webpage], but it still not working. Please help me in solving this problem.
private HikariDataSource dataSource() {
final HikariDataSource ds = new HikariDataSource();
ds.setMaximumPoolSize(100);
ds.setDataSourceClassName("oracle.jdbc.driver.OracleDriver");
ds.addDataSourceProperty("url", "jdbc:oracle:thin:@localhost:1521:XE");
ds.addDataSourceProperty("user", "username");
ds.addDataSourceProperty("password", "password");
ds.addDataSourceProperty("cachePrepStmts", true);
ds.addDataSourceProperty("prepStmtCacheSize", 250);
ds.addDataSourceProperty("prepStmtCacheSqlLimit", 2048);
ds.addDataSourceProperty("useServerPrepStmts", true);
return ds;
}
HikariDataSource
does not need to be configured with a constructor.HikariDataSource
extendsHikariConfig
, so you can just construct aHikariDataSource
and configure the properties on it directly. – brettw