我正在尝试在 postgresql 中使用 HikariCP,但在任何地方都找不到 postgresql 的配置。
请向我指出带有 HikariCP 的 postgresql 的任何示例或任何相同的配置教程。
我试着像下面那样使用它,但它没有用,然后我意识到它是为 MySQL 设计的
public static DataSource getDataSource()
{
if(datasource == null)
{
HikariConfig config = new HikariConfig();
config.setJdbcUrl("jdbc:mysql://localhost/test");
config.setUsername("root");
config.setPassword("password");
config.setMaximumPoolSize(10);
config.setAutoCommit(false);
config.addDataSourceProperty("cachePrepStmts", "true");
config.addDataSourceProperty("prepStmtCacheSize", "250");
config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
datasource = new HikariDataSource(config);
}
return datasource;
}
Run Code Online (Sandbox Code Playgroud)