Error on setting ConnectionInitSql with Hikari Version : 3.4.5

I am getting the following error when I upgrade my Hikari version to 3.4.5

The configuration of the pool is sealed once started. Use HikariConfigMXBean for runtime changes.

I am running the following @BeforeEach test

 dataSource.setConnectionInitSql("set search_path to " + getTestSchema() + ", public");

This is how I load my DataSource

public class DataSource {
  private static HikariConfig config = new HikariConfig();
  public static HikariDataSource ds;

  static {
        System.getProperty("jdbc.url", "jdbc:postgresql://localhost:123/abc"));
    config.setUsername(System.getProperty("username", "xyz"));
    config.setPassword(System.getProperty("password", "123"));
    ds = new HikariDataSource(config);

  private DataSource() {}

  public static Connection getConnection() throws SQLException {
    return ds.getConnection();

  public static void evictConnection(Connection connection) {
class TestClass extends DatabaseTestCase {
  private HikariDataSource dataSource;

  void initData() throws SQLException {
    DataSource.ds = dataSource;
    dataSource.setConnectionInitSql("set search_path to " + getTestVitmSchema() + ", public");

This is how I setSchema for the Test Cases

public abstract class DatabaseTestCase {

  private static final Logger log = Logger.getLogger(DatabaseTestCase.class.getName());

  private String testSchema;

  final void setupSchema() {
    int classHash = Math.abs(getClass().getSimpleName().hashCode());
    testSchema = String.format("test_%s", classHash);
    Map<String, String> placeholders = new HashMap<>();
    placeholders.put("schema", testSchema);
    placeholders.put("name", "xyz");
    placeholders.put("password", "123");
    Flyway flyway =

How can I set Connection Init Sql without getting the error. Thank you.

Read more here:

Content Attribution

This content was originally published by Tanu at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: