Package java.sql

Examples of java.sql.Statement.executeBatch()


    System.out.println("adding: " + inserttable);
    stmt.addBatch(inserttable);

    int[] updateCount=null;
    try {
      updateCount = stmt.executeBatch();
    } catch(SQLException se) {
       do {
        System.out.println("Exception chain: "+se.getMessage());
        se = se.getNextException();
      } while (se != null);
View Full Code Here


                batchDDLStatement = connection.createStatement();
                for (final String ddlEntry : ddls) {
                    batchDDLStatement.addBatch(ddlEntry);
                }
                batchDDLStatement.executeBatch();
            } catch (Exception sqlException) {
                throw BatchMessages.MESSAGES.failToCreateTables(sqlException, ddlFile, ddlString);
            }
            BatchLogger.LOGGER.tableCreated(ddlFile);
            BatchLogger.LOGGER.tableCreated2(ddlString);
View Full Code Here

      Statement stmnt = createStatement();
      try {
        for (Iterator<String> i = statements.iterator(); i.hasNext();) {
          stmnt.addBatch(i.next().toString());
        }
        int[] counts = stmnt.executeBatch();

        output(getColorBuffer().pad(getColorBuffer().bold("COUNT"), 8)
            .append(getColorBuffer().bold("STATEMENT")));

        for (int i = 0; counts != null && i < counts.length; i++) {
View Full Code Here

            else
            {
              statement.addBatch(StringEscapeUtils.unescapeJava(line));
            }
          }
          statement.executeBatch();
        }
        finally
        {
          statement.close();
        }
View Full Code Here

        s.execute("delete from t1");
        s.addBatch("insert into t1 values(1,1)");
        s.addBatch("insert into t1 values(2,2)");
        Savepoint savepoint1 = con.setSavepoint();
        s.addBatch("insert into t1 values(3,3)");
        s.executeBatch();
        con.rollback(savepoint1);

        assertTableRowCount("T1", 0);
        con.rollback();
    }
View Full Code Here

      sqlQuery = conn.expandQuery(sqlQuery + ";");

      s.addBatch(sqlQuery);
    }
    s.executeBatch();
  }

  protected final void deployTables() throws PermissionBackendException {
    try (SQLConnection conn = getSQL()) {
      if (conn.hasTable("{permissions}") && conn.hasTable("{permissions_entity}") && conn.hasTable("{permissions_inheritance}")) {
View Full Code Here

    conn.setAutoCommit(false);
    Statement stat = conn.createStatement();
    stat.addBatch("Insert into User(user_id,name) values(1,'testTransaction');");
    stat.addBatch("Insert into Photo(user_id,photo_id,tag) values(1,1,'tag');");
    int[] ret = stat.executeBatch();
    conn.commit();
    int successNum = 0;
    for (int i : ret) {
      if(i == 1) successNum++;
    }
View Full Code Here

            this.logger.log(Level.DEBUG, sql);
           
            statement.addBatch(sql);
          }
        }
        statement.executeBatch();
      }
      finally
      {
        Resources.close(statement);
      }
View Full Code Here

           
            statement.addBatch(sql);
          }
        }
       
        statement.executeBatch();
      }
      finally
      {
        Resources.close(statement);
      }
View Full Code Here

            this.logger.log(Level.DEBUG, sql);
           
            targetStatement.addBatch(sql);
          }
         
          targetStatement.executeBatch();
        }
        finally
        {
          Resources.close(targetStatement);
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.