[CONJ-219] User passed from HikariConfig becomes null Created: 2015-11-18  Updated: 2015-11-24  Resolved: 2015-11-19

Status: Closed
Project: MariaDB Connector/J
Component/s: Other
Affects Version/s: 1.3.0
Fix Version/s: 1.3.2

Type: Bug Priority: Major
Reporter: Fabien Leconte Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: None

Attachments: Java Source File TestMariaDB.java    
Issue Links:
Relates
relates to CONJ-114 Usage of the Connection Pool Apache D... Closed

 Description   

Hi,

We're using the MariaDB driver with HikariCp. Unfortunately, we can't set "user" parameter using the HikariConfig object.

When the pool initializes, we get this exception :

org.mariadb.jdbc.internal.util.dao.QueryException: Could not connect: Access denied for user ''@'localhost' (using password: NO)

After some debugging, it appears that the value is correctly set in the UrlParser object but is lost when "parseInternal" is called. The other params seems to be set later by Hikari so the only one missing is "user".

I've attached a test case to the issue.

Thanks.



 Comments   
Comment by Diego Dupin [ 2015-11-19 ]

A temporary replacement while analysing this :

replacing

properties.setProperty("user", "root");
properties.setProperty("password", "root");

by

config.setUsername("root");
config.setPassword("root");

would work.

Comment by Diego Dupin [ 2015-11-19 ]

corrected in next correction release 1.3.2.

Problem was indeed in urlParser :
HikariCP is doing :

  • Create Datasource
  • setUser
  • setPassword
  • setUrl
    in this order, setUrl was setting user and password defined in URL (null if no user/password options are set in url)
Comment by Fabien Leconte [ 2015-11-20 ]

Thanks for the workaround and the fix, that was quick .

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