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

Using a semicolon in a string with "rewriteBatchedStatements=true" fails

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 1.1.8
    • 1.1.9
    • Other
    • None
    • Windows 7, 64 bit

    Description

      I can reproduce the error I am submitting here with this code block:

       
          public static void main(String[] args) throws SQLException {
              MariaDB db = new MariaDB();
              Connection conn = db.getConnection();
              PreparedStatement sqlInsert = conn.prepareStatement("insert into prep (text) values (?)");
              sqlInsert.setString(1, "aa");
              sqlInsert.addBatch();
              sqlInsert.setString(1, "b;b");
              sqlInsert.addBatch();
              sqlInsert.executeBatch();
              conn.commit();
          }
       

      The connection uses "rewriteBatchedStatements=true"
      As soon as I use a semicolon in the string, I get an "String index out of range: -1"

      1. if I switch back to connector 1.1.7, I get no error
      2. if I set rewriteBatchedStatements to false, I get no error
      3. the MariaDB query.log is empty, i.e. the statement does not reach the database. Which is to be expected since the error is an java.lang.StringIndexOutOfBoundsException
      4. Tested on MariaDB 10.0.15, connector 1.1.8

      If you need any more infos, let me know.

      Attachments

        Issue Links

          Activity

            People

              ratzpo Rasmus Johansson (Inactive)
              Sektat Marcel Schneider
              Votes:
              2 Vote for this issue
              Watchers:
              5 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.