[CONJ-127] JDBCUrl.parseConnectorJUrl ignores username and password in url parameters Created: 2014-12-12  Updated: 2014-12-22  Resolved: 2014-12-22

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

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


 Description   

Documentation at https://mariadb.com/kb/en/mariadb/client-libraries/mariadb-java-client/about-the-mariadb-java-client/ specifies that "user" and "password" are valid url parameters.

JDBCUrl.parseConnectorJUrl instantiates both username and password of the resulting JDBCUrl as the empty string, no matter the input. This causes MySQLDataSource to treat the username and password as empty.

private static JDBCUrl parseConnectorJUrl(String url) {
        if (!url.startsWith("jdbc:mysql://")) {
            return null;
        }
        
        url = url.substring(13);
        String hostname;
        String database;
        String[] tokens = url.split("/");
        hostname=tokens[0];
        database=(tokens.length > 1)?tokens[1]:null;
        return new JDBCUrl("", "",  database, HostAddress.parse(hostname));
    }


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