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

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.1.9
    • Fix Version/s: 1.2.0
    • Component/s: Other
    • Labels:
      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

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

              Dates

              Created:
              Updated:
              Resolved:

                Git Integration