[CONJ-80] MySQLDataSource ignores calls to setPort/setDatabaseName/setServerName after calling getConnection Created: 2013-12-03  Updated: 2014-10-21  Resolved: 2014-10-21

Status: Closed
Project: MariaDB Connector/J
Component/s: None
Affects Version/s: 1.1.5
Fix Version/s: 1.1.8

Type: Bug Priority: Major
Reporter: Max Larsson Assignee: Massimo Siani (Inactive)
Resolution: Fixed Votes: 0
Labels: None


 Description   

As soon the getConnection method is called on an instance of MySQLDataSource a connection URL is constructed and cached.
The cached URL isn't cleared/reconstructed during a call to setPort/setDatabaseName/setServerName.
To reproduce it is important to call getConnection before changed on of
the properties, because as long getConnection hasn't been called, the
internal method createURL isn't called. The method creates a connection based on set properties, if the reference to the url is NULL. Hence the next
call just returns the cached URL, without taking any changes to port/databasename/servername into consideration.

I think it is easily fixable with just setting the url reference on NULL if a method of setPort/setDatabaseName/setServerName is called.


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