HikariCP with configuration property "initSQL" not supported?
213 views
Skip to first unread message
tilois
unread,
Jul 24, 2015, 7:16:29 PM7/24/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to play-framework
Hi everyone,
I am trying to use the configuration parameter "initSQL" which was previously provided by BoneCP and let each connection perform an action before it is added to the pool. My use case is to switch the schema to another on each connection.
HikariCP supports an equal concept by the "connectionInitSql" configuration property (see https://github.com/brettwooldridge/HikariCP). If I see this right, all that is left is a call to
So my assumption is that this is currently not supported but could be easily added?
Best Regards Tilois
tilois
unread,
Jul 25, 2015, 9:52:40 AM7/25/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to play-framework, timo...@gmail.com
Just a short update:
I have done a proof-of-concept in Java, which basically binds the `play.api.db.ConnectionPool` (yes, the Scala one in order to be able to still use the DBModule which relies on that beeing bound) to another connection pool which uses another HikariCP Configuration object which in turn reads the "InitSQL" parameter again.
This works fine for me now but was a bit of a hassle.
My suggestion would be:
1) Unrelated to my initial problem: Register a `Provider<HikariConfig>` to the Guice Injector to make that Mapping (Play Config to Hikari CP Config) more easily exchangeable. Disadvantage: If that Provider is not bound Guice will instantiate a default config which is not valid (ouch). Currently this mapping is more tighly coupled to the Connection Pool than it needs to be in my view.
2) Enhance the current mapping to read the "InitSQL" again and to pass it to the `setConnectionInitSql`.
In case this is acceptable, I would make a pull request. But before that, a question:
Where is the right place to expect the "InitSQL" configuration? Is it
a) db.default.initSQL or b) db.default.hikaricp.initSQL
My personal preference is for (a)
tilois
unread,
Jul 25, 2015, 9:53:19 AM7/25/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to play-framework, timo...@gmail.com
Marcos Silva Pereira
unread,
Jul 27, 2015, 10:05:17 AM7/27/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message