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

SQLException when calling PreparedStatement.executeBatch() without calling addBatch()

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 1.3.6
    • 1.3.7
    • Other
    • None

    Description

      In trying to migrate an application from MySQL to MariaDB, a user believs that they have found a bug in the MariaDB 1.3.6 java connector. If a program calls PreparedStatement.executeBatch() without any prior associated calls to PreparedStatement.addBatch() a SQLException is thrown:

      java.sql.SQLException: No Parameters set. The command addBatch() must have been set

      This exception is not thrown when using the MySQL connector or when using the older MariaDB 1.2.3 connector. The user's application also supports other RDBMS providers and this exception is not thrown by any of their connectors in this situation either. The Java API does not explicitly address this case in its description of the executeBatch() method but the fact that all other JDBC drivers handle this situation without an exception being thrown leads me to conclude that this is a bug with the MariaDB 1.3.6 connector.

      Attachments

        Activity

          diego dupin Diego Dupin added a comment -

          You are right, there is a difference using client prepared statement and server prepared statement.
          When no addBatch add been done, client return immediatly int[0], server throw an exception.

          Server return immediatly int[0] the same way.

          commit : https://github.com/MariaDB/mariadb-connector-j/commit/6634fa5c70ea22a55220e2e24a78d5021486e642

          diego dupin Diego Dupin added a comment - You are right, there is a difference using client prepared statement and server prepared statement. When no addBatch add been done, client return immediatly int [0] , server throw an exception. Server return immediatly int [0] the same way. commit : https://github.com/MariaDB/mariadb-connector-j/commit/6634fa5c70ea22a55220e2e24a78d5021486e642

          People

            diego dupin Diego Dupin
            GeoffMontee Geoff Montee (Inactive)
            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.