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

rewriteBatchedStatements causes "QueryException: Query was empty"

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 1.5.0-RC
    • 1.5.1-RC
    • Other
    • None

    Description

      Adding rewriteBatchedStatements=true causes a java.sql.PreparedStatement without parameters to fail. It will throw org.mariadb.jdbc.internal.util.dao.QueryException: Query was empty.

      Demonstration is included below.
      This was tested using mariadb-java-client-1.5.0-RC1.jar

       
      public class RewriteBatchedStatementsTest {
      	public static void main(String[] args) throws SQLException {
      		String failingURL = "jdbc:mariadb://localhost:3306/information_schema?rewriteBatchedStatements=true";
      		String workingURL = "jdbc:mariadb://localhost:3306/information_schema";
      		String url = failingURL;
      		Connection conn = DriverManager.getConnection(url, "root", "");
      		try {
      			PreparedStatement statement = conn.prepareStatement("SELECT 1");
      			try {
      				statement.executeQuery();
      			} finally {
      				statement.close();
      			}
      		} finally {
      			conn.close();
      		}
      	}
      }
      
      

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            jaapbeetstra Jaap Beetstra
            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.