[CONJ-335] regression : Pool connection may fail to connect with good user Created: 2016-08-23  Updated: 2016-08-23  Resolved: 2016-08-23

Status: Closed
Project: MariaDB Connector/J
Component/s: Other
Affects Version/s: 1.5.0-RC, 1.5.1-RC
Fix Version/s: 1.5.2

Type: Bug Priority: Critical
Reporter: Diego Dupin Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: 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);



 Comments   
Comment by Diego Dupin [ 2016-08-23 ]

fixed with commit : https://github.com/MariaDB/mariadb-connector-j/commit/ff7b1db7927147a7bf87b00cc1ecee2f3850b267

Generated at Thu Feb 08 03:14:54 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.