From b9270ea58d5a0d4647b1720c5d15bedb123966ae Mon Sep 17 00:00:00 2001 From: Sebastian Beigel Date: Wed, 6 Feb 2019 13:06:10 +0100 Subject: [PATCH 1/2] HikariCP: config property for init connection sql added --- framework/src/play/db/hikaricp/HikariDataSourceFactory.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/framework/src/play/db/hikaricp/HikariDataSourceFactory.java b/framework/src/play/db/hikaricp/HikariDataSourceFactory.java index 32f4969a07..ff4110541a 100644 --- a/framework/src/play/db/hikaricp/HikariDataSourceFactory.java +++ b/framework/src/play/db/hikaricp/HikariDataSourceFactory.java @@ -36,6 +36,10 @@ public DataSource createDataSource(Configuration dbConfig) throws PropertyVetoEx ds.setLoginTimeout(parseInt(dbConfig.getProperty("db.pool.loginTimeout", "0"))); // in seconds ds.setMaxLifetime(parseLong(dbConfig.getProperty("db.pool.maxConnectionAge", "0"))); // in ms + if (dbConfig.getProperty("db.pool.connectionInitSql") != null) { + ds.setConnectionInitSql(dbConfig.getProperty("db.pool.connectionInitSql")); + } + // not used in HikariCP: // db.pool.initialSize // db.pool.idleConnectionTestPeriod From 07cd3ab55078050a86b4abba2c1dad0793afb24a Mon Sep 17 00:00:00 2001 From: Sebastian Beigel Date: Thu, 7 Feb 2019 07:59:47 +0100 Subject: [PATCH 2/2] documentation added --- documentation/manual/configuration.textile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/documentation/manual/configuration.textile b/documentation/manual/configuration.textile index ddcaad3801..b1874f44c8 100644 --- a/documentation/manual/configuration.textile +++ b/documentation/manual/configuration.textile @@ -527,6 +527,12 @@ c3p0 is very asynchronous. Slow JDBC operations are generally performed by helpe Default: @3@ +h3(#db.pool.connectionInitSql). db.pool.connectionInitSql + +Sets the SQL string that will be executed on all new connections when they are created, before they are added to the pool (HikariCP only). + +Default: none + h2(#evolutions). Database evolutions