Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • None
    • 1.1.3
    • None
    • None

    Description

      Chris Calender reports :

      There is a bug in the current release of the MariaDB Java Client v1.1.2 with usage of MySQL Server in version 5.5.25a

      If using prepared statements with parameters the call of PreparedStatement#getMetaData() always fails with an Exception.
      PreparedStatement#getMetaData() fails if the query contains at least one '?' for a parameter.

      This error can be reproduced simply by executing the TestSQL Java class attached to this email.

      The Exception is always the following:
      Exception in thread "main" java.nio.BufferUnderflowException
      at java.nio.Buffer.nextGetIndex(Buffer.java:498)
      at java.nio.HeapByteBuffer.getLong(HeapByteBuffer.java:406)
      at org.mariadb.jdbc.internal.common.packet.buffer.Reader.readLong(Reader.java:111)
      at org.mariadb.jdbc.internal.common.packet.buffer.Reader.getLengthEncodedBinary(Reader.java:173)
      at org.mariadb.jdbc.internal.common.packet.buffer.Reader.skipLengthEncodedBytes(Reader.java:140)
      at org.mariadb.jdbc.internal.mysql.MySQLColumnInformation.<init>(MySQLColumnInformation.java:118)
      at org.mariadb.jdbc.internal.mysql.MySQLProtocol.prepare(MySQLProtocol.java:510)
      at org.mariadb.jdbc.MySQLServerSidePreparedStatement.prepare(MySQLServerSidePreparedStatement.java:33)
      at org.mariadb.jdbc.MySQLServerSidePreparedStatement.<init>(MySQLServerSidePreparedStatement.java:45)
      at org.mariadb.jdbc.MySQLPreparedStatement.getMetaData(MySQLPreparedStatement.java:330)
      at TestSQL.main(TestSQL.java:21)

      Test:

      import java.sql.*;

      public class TestSQL {

      public static void main(String[] args) throws Exception

      { Class.forName("org.mariadb.jdbc.Driver"); String dbUrl = "jdbc:mysql://harley:3306/pm"; Connection con = DriverManager.getConnection(dbUrl, "pm", "pm"); System.out.println("Connected to " + dbUrl); String queryOk = "SELECT * FROM PMV_EP_QOS_CALLS WHERE IPADDR = '1.0.10.188'"; String queryFail = "SELECT * FROM PMV_EP_QOS_CALLS WHERE IPADDR = ?"; PreparedStatement prepStmt1 = con.prepareStatement(queryOk); ResultSetMetaData md1 = prepStmt1.getMetaData(); System.out.println("Got ResultSetMetaData for: " + queryOk); PreparedStatement prepStmt2 = con.prepareStatement(queryFail); prepStmt2.setString(1, "1.0.10.188"); ResultSetMetaData md2 = prepStmt2.getMetaData(); // getMetaData() fails if the query contains at least one '?' con.close(); }

      Attachments

        Activity

          wlad Vladislav Vaintroub created issue -
          wlad Vladislav Vaintroub made changes -
          Field Original Value New Value
          Key MDEV-4625 CONJ-43
          Project MariaDB Development [ 10000 ] MariaDB Client Library for Java Applications [ 10301 ]
          wlad Vladislav Vaintroub made changes -
          Assignee Vladislav Vaintroub [ wlad ]
          wlad Vladislav Vaintroub made changes -
          Fix Version/s jdbc-1.1.3 [ 13100 ]
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Closed [ 6 ]
          ratzpo Rasmus Johansson (Inactive) made changes -
          Workflow defaullt [ 27648 ] MariaDB v2 [ 47875 ]
          ratzpo Rasmus Johansson (Inactive) made changes -
          Workflow MariaDB v2 [ 47875 ] MariaDB connectors [ 54961 ]
          ratzpo Rasmus Johansson (Inactive) made changes -
          Workflow MariaDB connectors [ 54961 ] MariaDB v3 [ 70176 ]
          serg Sergei Golubchik made changes -
          Workflow MariaDB v3 [ 70176 ] MariaDB v4 [ 134682 ]

          People

            wlad Vladislav Vaintroub
            wlad Vladislav Vaintroub
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.