Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-3060

Network Server incorrectly assumes that all SQLExceptions with error code 08004 are caused by an authentication failure.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 10.3.1.4, 10.4.1.3
    • 10.4.1.3
    • Network Server
    • None

    Description

      DRDAConnThread#getConnFromDatabaseName incorrectly assumes that all SQLExceptions with error code 08004 thrown when trying to connect to a database are caused by an authentication failure.

      DRDAConnThread lines 1295-1296:
      -----8<-----
      if (sqlState.regionMatches(0,SQLState.LOGIN_FAILED,0,5))
      return CodePoint.SECCHKCD_USERIDINVALID;
      ----->8-----

      I have added an exception to BasicDatabase#setupConnection with error code 08004.C.7. The exception is thrown if the connection is refused because the database has been booted in slave replication mode. This exception is, however, translated into an authentication exception by DRDAConnThread:

      When the NetworkServer has already booted a database 'test' in slave replication mode, I get the following output from ij:

      ij> connect 'jdbc:derby://localhost/test';
      ERROR 08004: Connection authentication failure occurred. Reason: userid or password invalid.

      If I change the SQL code of the exception to XRE02.C and repeat, I get:

      ij> connect 'jdbc:derby://localhost/test';
      ERROR XRE02: DERBY SQL error: SQLCODE: -1, SQLSTATE: XRE02, SQLERRMC: Connect refused to database 'test' because it is in replication slave mode.

      Attachments

        1. derby-3060-1.diff
          6 kB
          Jorgen Loland
        2. derby-3060-1.stat
          0.2 kB
          Jorgen Loland

        Issue Links

          Activity

            People

              jorgenlo Jorgen Loland
              jorgenlo Jorgen Loland
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: