Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-5155

com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource cannot connect to MariaDB with password

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 10.0.4, 5.2.14, 5.3.12, 5.5.33a, 10.1, 10.0
    • Fix Version/s: 10.1, 10.0
    • Component/s: None
    • Labels:
    • Environment:
      Debian 6 x86_64, Connector/J 5.1.20

      Description

      My application runs on the Resin application server, and uses JDBC Connection pooling. After upgrading
      the DB server from Mysql 5.5.29 to MariaDB 5.5.33a it is unable to log in to the database.

      The application server is resin 4.0.18, the JDBC connector is Connector/J 5.1.20

      I have done some debugging, and the problem seems to be that when the Connection pool hands a connection to the application, it performs a 'change user' command to reset the connection, and MariaDB cannot authenticate this command the way MySQL can.

      When the user has no password set, the JDBC pooling + MariaDB connection works.

      Specifically, MySQL and MariaDB behaves the same way, until the client issues a 'change user' request.
      Replying to this, MySQL sends a response, then the client sends a request type 234, and the change user command is successful.
      Replying to this, MariaDB sends a different response, then the client sends a request type 108, and the change user command is unsuccessful.

      My test setup:

      Client workstation: 10.6.118.61
      MariaDB server: 10.6.118.100
      Mysql server :10.5.2.36 ( it is behind NAT, it sees the client coming from 193.151.116.11 )

      The test cases:

      server: MySQL server
      client: client workstation
      program: Resin pooling + Connector/J
      user: 'stoty'/'badpassword'
      result: success

      server: MariaDB server
      client: client workstation
      program: Resin pooling + Connector/J
      user: 'stoty'/'badpassword'
      result: fails

      server: MariaDB server
      client: MariaDB (resin running locally on DB server)
      program: Resin pooling + Connector/J
      user: 'root'/ no password
      result: success

      server: MySQL server
      client: client workstation
      program: mysql cli
      user: 'stoty'/'badpassword'
      result: success

      server: MariaDB server
      client: client workstation
      program: mysql cli
      user: 'stoty'/'badpassword'
      result: success

      I have attached the packet capture files for all five test cases.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              stoty Tóth István added a comment -

              Yes, the attached dumps are recoring 5.1.20 behaviour.

              I have attached a patch against Connector/J 5.1.27 that makes it behave according to your description of the protocol.
              With this patch, the test case connects successfully to MariaDB 5.5.33a.
              Tomorrow I will test it against MySQL as well.

              Show
              stoty Tóth István added a comment - Yes, the attached dumps are recoring 5.1.20 behaviour. I have attached a patch against Connector/J 5.1.27 that makes it behave according to your description of the protocol. With this patch, the test case connects successfully to MariaDB 5.5.33a. Tomorrow I will test it against MySQL as well.
              Hide
              stoty Tóth István added a comment -

              tenative patch for Connector/J 5.1.27

              Show
              stoty Tóth István added a comment - tenative patch for Connector/J 5.1.27
              Hide
              stoty Tóth István added a comment -

              I have successfully tested the patch against Mysql 5.5.31 as well.

              Show
              stoty Tóth István added a comment - I have successfully tested the patch against Mysql 5.5.31 as well.
              Hide
              serg Sergei Golubchik added a comment -

              Yes, I've already reported a bug at bugs.mysql.com, let's hope it'll be fixed in the next release.

              Show
              serg Sergei Golubchik added a comment - Yes, I've already reported a bug at bugs.mysql.com, let's hope it'll be fixed in the next release.
              Hide
              elenst Elena Stepanova added a comment -

              Still reproducible with Connector/J 5.1.32 and MariaDB 10.1 (10.1.4 pre-release).
              The upstream bug has been staying in 'Verified' for almost 1.5 years by now.

              Show
              elenst Elena Stepanova added a comment - Still reproducible with Connector/J 5.1.32 and MariaDB 10.1 (10.1.4 pre-release). The upstream bug has been staying in 'Verified' for almost 1.5 years by now.

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  stoty Tóth István
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:

                    Time Tracking

                    Estimated:
                    Original Estimate - 0 minutes
                    0m
                    Remaining:
                    Remaining Estimate - 0 minutes
                    0m
                    Logged:
                    Time Spent - 2 hours
                    2h