Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
2.0.0-RC, 1.6.0, 2.0.1
-
None
Description
Environment:
HikariCP version: 2.6.1
JDK version : 1.8.0_125
Database : MySQL
Driver :org.mariadb.jdbc.Driver
Driver version : 2.0.1
Issue:
Running into a weird issue while using HikariCP with mariadb connector. HikariCP pool stuck at start up sequence after I changed com.mysql.jdbc.Driver to org.mariadb.jdbc.Driver
Usage:
String driver = "org.mariadb.jdbc.Driver";
String jdbcUrl = "jdbc:mysql://mysql_host:3306";
Class.forName(driver);
HikariConfig config = new HikariConfig();
config.setDriverClassName(driver);
config.setJdbcUrl(jdbcUrl);
config.setUsername(user);
config.setPassword(password);
config.setConnectionTimeout(30000);
config.setMaximumPoolSize(20);
config.setAutoCommit(false);
config.addDataSourceProperty("cachePrepStmts", true);
config.addDataSourceProperty("prepStmtCacheSize", 250);
config.addDataSourceProperty("prepStmtCacheSqlLimit", 2048);
datasource = new HikariDataSource(config);
The application stuck at the line:
datasource = new HikariDataSource(config);
Got this log while I'm using "com.mysql.jdbc.Driver":
thread="main" log="INFO" class="c.z.h.HikariDataSource" HikariPool-5 - Starting...
thread="main" log="INFO" class="c.z.h.HikariDataSource" HikariPool-5 - Start completed.
But after switching to mariadb connector, this is the last line I see:
thread="main" log="INFO" class="c.z.h.HikariDataSource" HikariPool-5 - Starting...
Note: I've tested with multiple mysql servers as well as an Aurora one. Regardless of which one is used as jdbc URL, HikariDataSource fails starting as long as I use mariadb driver.
Temporary Solution:
I've done testing by downgrading mariadb driver to version 1.5.4 and this solved the connection hanging problem.
With more testing I found out the latest version that can work well with Aurora is 1.5.9
After going through the change log for 1.6.0 / 2.0.0-RC, I found out the culprit: usePipelineAuth is default to true.
- Either downgrade to version 1.5.9 or below
- Or continue using 1.6.0 / 2.0.0 / 2.0.1 and mark usePipelineAuth=false in the jdbc url.
Attachments
Issue Links
- relates to
-
CONJ-474 Aurora sqltransientconnectionexception when using 1.6.0
- Closed