Skip to content

Commit

Permalink
Merge pull request playframework#1293 from sbeigel/hikari-initsql
Browse files Browse the repository at this point in the history
HikariCP: config property for init connection sql added
  • Loading branch information
xael-fry authored Feb 23, 2019
2 parents 41f821f + 07cd3ab commit 6881747
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions documentation/manual/configuration.textile
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
4 changes: 4 additions & 0 deletions framework/src/play/db/hikaricp/HikariDataSourceFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6881747

Please sign in to comment.