Package java.sql

Examples of java.sql.Statement.executeBatch()


        try
        {
            stmt.executeBatch();
            fail ("Batch is expected to fail");
            updateCount = stmt2.executeBatch();
        } catch (BatchUpdateException bue) {
            /* Ensure the exception is time out while getting lock */
            if (usingEmbedded())
                assertSQLState("40XL1", bue);
            else if (usingDerbyNetClient())
View Full Code Here


    try {
      for (int i = 0, n = statementList.size(); i < n; i++) {
        Statement stmt = statementList.get(i);
        BatchResult batchResult = batchResultList.get(i);
        try {
          batchResult.setUpdateCounts(stmt.executeBatch());
          MappedStatement ms = batchResult.getMappedStatement();
          Object parameter = batchResult.getParameterObject();
          KeyGenerator keyGenerator = ms.getKeyGenerator();
          if (keyGenerator instanceof Jdbc3KeyGenerator) {
            keyGenerator.processAfter(this, ms, stmt, parameter);
View Full Code Here

           out.flush();
        }  
        statement.addBatch(query);             
      }     
       
      statement.executeBatch();
      totalTableFilled++;
   
      if(Log4jManager.IS_LOGGING_CONFIGURED)
         logger.info("--------- Table: "+currentTable+" filled successfully");
    
View Full Code Here

        st = proxyConnection.createStatement();
        st.addBatch(INSERT1);
      st.addBatch(INSERT2);
      st.addBatch(INSERT3);
      st.addBatch(INSERT4);
        int[] updateCounts = st.executeBatch();
        assertEquals(4, updateCounts.length);
        assertEquals(1, updateCounts[0]);
        ResultSet rs = st.executeQuery("select id, name, last_name, age, money, alive, dob, lastScan  from test");
        while (rs.next()) {
          rs.getInt(1);
View Full Code Here

      multiStmt.addBatch("INSERT INTO testStatementRewriteBatch(field1) VALUES (3)");
      multiStmt.addBatch("INSERT INTO testStatementRewriteBatch(field1) VALUES (4)");
      multiStmt.addBatch("UPDATE testStatementRewriteBatch SET field1=5 WHERE field1=1");
      multiStmt.addBatch("UPDATE testStatementRewriteBatch SET field1=6 WHERE field1=2 OR field1=3");

      int[] counts = multiStmt.executeBatch();

      if (!isRunningOnJdk131()) {
        ResultSet genKeys = multiStmt.getGeneratedKeys();

        for (int i = 1; i < 5; i++) {
View Full Code Here

      for (int i = 0; i < 1000; i++) {
        multiStmt.addBatch("INSERT INTO testStatementRewriteBatch(field1) VALUES (" + i + ")");
      }

      multiStmt.executeBatch();

      if (!isRunningOnJdk131()) {
        ResultSet genKeys = multiStmt.getGeneratedKeys();

        for (int i = 1; i < 1000; i++) {
View Full Code Here

      }
     
      this.stmt.execute("TRUNCATE TABLE rewriteErrors");
     
      try {
        multiStmt.executeBatch();
      } catch (BatchUpdateException bUpE) {
        int[] counts = bUpE.getUpdateCounts();
 
        for (int i = 4094; i < counts.length; i++) {
          assertEquals(counts[i], Statement.EXECUTE_FAILED);
View Full Code Here

        reconnectStmt.addBatch("INSERT INTO testBug13255 VALUES (" + i
            + ")");
      }

      try {
        reconnectStmt.executeBatch();
      } catch (SQLException sqlEx) {
        // We expect this...we killed the connection
      }

      assertEquals(2, getRowCount("testBug13255"));
View Full Code Here

      updateCountsPstmt = e1.getUpdateCounts();
    }

    int[] updateCountsStmt = null;
    try {
      updateCountsStmt = statement.executeBatch();
    } catch (BatchUpdateException e) {
      e2 = e;
      updateCountsStmt = e1.getUpdateCounts();
    }
View Full Code Here

        .addBatch("UPDATE testBug25073 SET field1=6 WHERE field1=2 OR field1=3");

    int beforeOpenStatementCount = ((com.mysql.jdbc.Connection) multiConn)
        .getActiveStatementCount();

    multiStmt.executeBatch();

    int afterOpenStatementCount = ((com.mysql.jdbc.Connection) multiConn)
        .getActiveStatementCount();

    assertEquals(beforeOpenStatementCount, afterOpenStatementCount);
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.