Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-166

SQLException for "Access denied for user" does not contain the vendor code

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 1.1.9
    • 1.2.0
    • Other
    • None

    Description

      Trying to connect with a wrong username or password returns an SQLException which does not contain the correct expected error code (1045).

      Trying with command line:
      >mysql -u bar -pfoo testdb
      ERROR 1045 (28000): Access denied for user 'bar'@'localhost' (using password: YES)

      Using the attached test program reproduces the error:

      Output MariaDB connector
      MariaDB Exception: java.sql.SQLException: Could not connect: Access denied for user 'foo'@'localhost' (using password: YES)
      MariaDB ErrorCode: -1
      MariaDB SQLState: HY0000

      Output MySQL connector
      MySQL Exception: java.sql.SQLException: Access denied for user 'foo'@'localhost' (using password: YES)
      MySQL ErrorCode: 1045
      MySQL SQLState: 28000

      -> We need this error code in order to be able to detect if a connection is setup using a wrong username or password.

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            bazzip Paolo Bazzi
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.