Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
1.5.0-RC, 1.5.1-RC
-
None
Description
Using MySQLDataSource or MariaDbDataSource to connect from pool has a regression :
MariaDbDataSource datasource = new MariaDbDataSource();
datasource.setUser("USER");
datasource.setPassword("PWD");
datasource.setUrl("jdbc:mariadb://localhost:3306/db");
Connection will use current current windows user (if using windows), not user "USER1"
MariaDbDataSource datasource = new MariaDbDataSource();
datasource.setUser("USER");
datasource.setPassword("PWD");
datasource.setUrl("jdbc:mariadb://localhost:3306/db?user=USER1");
Connection will use user "USER1"
recommended way to connect a pool is using Driver implementation, not DataSource
example :
final HikariDataSource ds = new HikariDataSource();
ds.setMaximumPoolSize(20);
ds.setDriverClassName("org.mariadb.jdbc.Driver");
ds.setJdbcUrl("jdbc:mariadb://localhost:3306/db");
ds.addDataSourceProperty("user", "root");
ds.addDataSourceProperty("password", "myPassword");
ds.setAutoCommit(false);