[CONJ-89] clientInfoProperties never populated in org.mariadb.jdbc.MySQLConnection Created: 2014-04-03  Updated: 2018-08-26  Resolved: 2014-09-09

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

Type: Bug Priority: Minor
Reporter: Erik Mattheis Assignee: Massimo Siani (Inactive)
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to CONJ-637 java.sql.Driver class is missing Driv... Closed

 Description   

I want to be able to determine whether or not a connection has been established with a certain optional property (useFractionalSeconds). I should be able to use connection.getClientInfo("useFractionalSeconds") to do this, but it looks like the properties are never populated.

org.mariadb.jdbc.MySQLConnection

private MySQLConnection( MySQLProtocol protocol) {
    this.protocol = protocol;
    clientInfoProperties = new Properties();
}

I suggest populating the properties from the protocol:

org.mariadb.jdbc.MySQLConnection

private MySQLConnection( MySQLProtocol protocol) {
    this.protocol = protocol;
    clientInfoProperties = new Properties();
    clientInfoProperties.putAll(protocol.getInfo());
}

and probably a good idea to not include user and password:

org.mariadb.jdbc.Driver

public Connection connect(final String url, final Properties info) throws SQLException {
// snip
        String userName = info.getProperty("user",jdbcUrl.getUsername());
        String password = info.getProperty("password",jdbcUrl.getPassword());
        
        info.remove("user");
        info.remove("password");
 
        MySQLProtocol protocol = new MySQLProtocol(jdbcUrl, userName,  password,  info);
// snip
}



 Comments   
Comment by Massimo Siani (Inactive) [ 2014-07-07 ]

Fixed in rev 516.

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