Package java.sql

Examples of java.sql.PreparedStatement.executeBatch()


             
              id += 1;
          }
         
          //executing the batch...
          ps.executeBatch();
        }
       
        conn.commit();
   
    log.info("Repeated batch JDBC inserts successfuly executed.");
View Full Code Here


        for (int i = 0; i < 10; i++) {
            pstmt.setInt(1, i);
            pstmt.addBatch();
        }

        pstmt.executeBatch();

        //
        sql   = "select count(*) from test where id in(?,?)";
        pstmt = conn.prepareStatement(sql);

View Full Code Here

                pst.setInt(2, i);
                pst.setString(3, "string2_" + i);
                pst.addBatch();

                if ((i > 0) && (i % 100 == 0)) {
                    pst.executeBatch();
                }
            }

            pst.close();
View Full Code Here

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

        prep.addBatch();

        int[] updateCounts = prep.executeBatch();

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

            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

        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

            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

                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

      " 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

          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

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.