This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-17. For the latest, interactive version please visit https://mariadb.com/kb/.

Access Denied Error updating from JDBC Connector 1.6.5 to 1.7.0

Hi,

Using the MariaDB JDBC Connector version 1.6.5 I can easily connect to the database using my username and password (the password is in UTF-8 charset and contains only the numbers) but changing the Connector version to 1.7.0 I got the following error:

Caused by: java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
Current charset is UTF-8. If password has been set using other charset, consider using option 'passwordCharacterEncoding'
	at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.authentication(AbstractConnectProtocol.java:852)
	at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.handleConnectionPhases(AbstractConnectProtocol.java:757)
	at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connect(AbstractConnectProtocol.java:415)
	at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:1128)

However dowgrading the Connector to the connetcion establish seccessfully again. The only way to connect using the Connector version 1.7.0 is to left the username and password blank and as my current user has no password It can connect.

I just want to know what is the differences (new features) in version 1.7.0 that cause these to happen.

Here is my sample source code:

public void open(int i, int i1){
        drivername = "org.mariadb.jdbc.Driver"
        url = "jdbc:mariadb://localhost?useUnicode=true&characterEncoding=utf-8"
        try {
            Class.forName(drivername);
            if (username == null) {
                connection = (MariaDbConnection)DriverManager.getConnection(dbURL);
            } else {
                connection = (MariaDbConnection)DriverManager.getConnection(dbURL, username, password);
            }
            statement = (MariaDbStatement) connection.createStatement();
        } catch (SQLException | ClassNotFoundException e) {
            e.printStackTrace();
        }
    }

I also tried appending &passwordCharacterEncoding=UTF-8 to url.

Answer Answered by Diego Dupin in this comment.

sorry for late answer, i've not seen anything that can cause that kind of issue in changelog (https://mariadb.com/kb/en/library/mariadb-connector-j-170-changelog/)

Nothing has been reported about that kind of error in JIRA. Don't hesitate to create a JIRA issue (https://jira.mariadb.org/projects/CONJ) if that kind of error occurs

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.