Configuring H2 and MySQL loadbalanced connections the "Hikari" way

320 views
Skip to first unread message

Diwaker Gupta

unread,
Sep 15, 2014, 3:13:09 PM9/15/14
to hika...@googlegroups.com
Hikari docs are clearly biased in favor of using the DataSource properties over the JDBC URI method of configuring data sources. While I've made good progress with regular MySQL, I'm struggling to configure H2 and MySQL loadbalanced connections properly this way.

H2, because the H2 DataSource class exposes very limited properties as bean methods (https://code.google.com/p/h2database/source/browse/trunk/h2/src/main/org/h2/jdbcx/JdbcDataSource.java) E.g. there's no way to configure DB_CLOSE_DELAY, LOCK_TIMEOUT and other such properties.

MySQL loadbalanced connections because they rely on the URL starting with "jdbc:mysql:loadbalance" -- this is apparently hard-coded in the Connector/J driver and I couldn't find any bean methods on the DataSource class to indicate to the driver that I'm trying to configure a loadbalanced data source.

If others have any experience configuring H2 and MySQL load balanced connections the Hikari way, I'd love to hear about it!

Thanks,
Diwaker

Brett Wooldridge

unread,
Sep 16, 2014, 12:56:55 AM9/16/14
to hika...@googlegroups.com
While we do recommend using DataSource as the "Hikari way", as configurations tend to be more maintainable, it is certainly not a requirement.  Some driver vendors have yet to expose all configuration options through their DataSource.  In these cases you have no choice but to use URI-based configuration.


Reply all
Reply to author
Forward
0 new messages