Examples of executeBatch()


Examples of java.sql.PreparedStatement.executeBatch()

            prep.setDouble(ii + 3, 0.123456789);    // Wert
        }

        prep.addBatch();

        int[] updateCounts = prep.executeBatch();

        con.setAutoCommit(true);
        prep.close();
    }
View Full Code Here

Examples of java.sql.PreparedStatement.executeBatch()

            for (int i = 1; i <= 4; i++) {    // [2, 3, 4]
                prep.setInt(1, i);
                prep.addBatch();
                System.out.println("executeBatch() for " + i);
                prep.executeBatch();
                con.commit();

                // prep.clearBatch(); // -> java.lang.NullPointerException
                // at org.hsqldb.Result.getUpdateCounts(Unknown Source)
            }
View Full Code Here

Examples of java.sql.PreparedStatement.executeBatch()

        for (int i = 0; i < 10000; i++) {
            pstmt.setString(1, "name" + i);
            pstmt.addBatch();
        }

        pstmt.executeBatch();

//
        sql = "select count(*) from test where name = (select max(name) from empty)";
        rs = stmt.executeQuery(sql);

View Full Code Here

Examples of java.sql.PreparedStatement.executeBatch()

            ps.setLong(2, 23456789123458L);
            ps.setCharacterStream(3, reader, 100);
            ps.setString(4, "test-scope-3");
            ps.addBatch();

            int[] results = ps.executeBatch();

            //
            try {
                InputStream fis =
                    getClass().getResourceAsStream(resourceFileName);
View Full Code Here

Examples of java.sql.PreparedStatement.executeBatch()

                throw new UnableToExecuteStatementException("Exception while binding parameters", e);
            }

            try {
                final long start = System.currentTimeMillis();
                final int[] rs =  stmt.executeBatch();
                log.logPreparedBatch(System.currentTimeMillis() - start,  rewritten.getSql(), parts.size());
                return rs;
            }
            catch (SQLException e) {
                throw new UnableToExecuteStatementException(e);
View Full Code Here

Examples of java.sql.PreparedStatement.executeBatch()

      " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);", null);

    for (SpeakerNPC npc : SingletonRepository.getNPCList()) {
      dumpNPC(stmt, npc);
    }
    stmt.executeBatch();
    logger.debug("Completed dumping of NPCs in " + (System.currentTimeMillis() - start) + " milliseconds.");
  }

  /**
   * dumps all NPCs
View Full Code Here

Examples of java.sql.PreparedStatement.executeBatch()

          for (int i = 0; i < params.length; i++) {
            adaptors[i].set(pstat, params[i], i + 1);
          }
          pstat.addBatch();// 需要配置一下batchSize,嘻嘻,不然分分钟爆内存!!
        }
        int[] counts = pstat.executeBatch();

        pstat.close();
        statIsClosed = true;
        conn.commit();
        conn.setAutoCommit(oldAutoCommit);
View Full Code Here

Examples of java.sql.PreparedStatement.executeBatch()

          ps.setInt(1, i%2);
            ps.setString(2, "Tuple " +i);
            ps.setString(3, "any value");
            ps.addBatch();
        }
        ps.executeBatch();

    s.execute("call SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(1)");
   
    //Executing the query below and looking at it's plan will show that
    //we picked index T2I1 rather than T2I2 because there are no
View Full Code Here

Examples of java.sql.PreparedStatement.executeBatch()

          }
          i++;
        }
        prep.addBatch();
        conn.setAutoCommit(false);
        prep.executeBatch();
        conn.commit();
        prep.close();
        prep = null;
      } catch (Throwable e) {
        if (!omitErrorLogs) {
View Full Code Here

Examples of java.sql.PreparedStatement.executeBatch()

      dataStmt.setInt(3, relLoc.getBlockZ());
      dataStmt.setString(4, block.getType().toString());
      dataStmt.setShort(5, block.getData().toItemStack().getDurability());
      dataStmt.addBatch();
      if (++changed % batchSize == 0) {
        dataStmt.executeBatch();
      }
    }
    dataStmt.executeBatch(); // insert remaining records
    databaseConnection.commit();
    databaseConnection.setAutoCommit(true);
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.