title: SQL batch update - rollback on "CREATE TABLE"?
body: <p>I have a method for upgrading DB:</p>
  
  <pre><code>private void executeUpdateBatch(String... sql) throws SQLException {
      JdbcConnection connJbdc = new JdbcConnectionImpl();
      Connection conn = connJbdc.getConnection();
      conn.setAutoCommit(false);
      Statement st = conn.createStatement();
  
      for(String s : sql) {
          st.addBatch(s);
      }
  
      try {
          // execute the batch
          int[] updateCounts = st.executeBatch();
        } catch (BatchUpdateException e) {
          int[] updateCounts = e.getUpdateCounts();
          checkUpdateCounts(updateCounts);
          try {
            conn.rollback();
          } catch (Exception e2) {
          }
  
          throw new SQLException(e);
        }
        // since there were no errors, commit
        conn.commit();
  
        st.close();
        conn.close();
  }
  </code></pre>
  
  <p>And upgrade method:</p>
  
  <pre><code>public void upgradeTo5() throws SQLException {
      executeUpdateBatch("CREATE TABLE project ("
              + "id INT(10) unsigned NOT NULL auto_increment, "
              + "title VARCHAR(255) NOT NULL, "
              + "date_from DATE NULL, date_to DATE NULL,"
              + "active BIT NOT NULL, PRIMARY KEY (id))",
              "INSERT INTO project(titlea) VALUES('test1')");
  }
  </code></pre>
  
  <p>An error is in <code>INSERT</code> just for testing rollback.</p>
  
  <p>Well, the problem now is that it does not rollbacks <code>CREATE TABLE project</code>. Table is InnoDB. Any suggestions?</p>