Package java.sql

Examples of java.sql.PreparedStatement.executeBatch()


               }
            }
            objFromStream = marshaller.objectFromObjectStream(objectInput);
         }
         if (readCount % batchSize != 0) {
            ps.executeBatch();//flush the batch
         }
         if (log.isTraceEnabled()) {
            log.trace("Successfully inserted " + readCount + " buckets into the database, batch size is " + batchSize);
         }
      } catch (IOException ex) {
View Full Code Here


               ps.setLong(2, bucket.timestampOfFirstEntryToExpire());
               ps.setString(3, bucket.getBucketName());
               ps.addBatch();
               updateCount++;
               if (updateCount % batchSize == 0) {
                  ps.executeBatch();
                  if (log.isTraceEnabled()) log.trace("Flushing batch, update count is: " + updateCount);
               }
            } else {
               it.remove();
               emptyBuckets.add(bucket);
View Full Code Here

            }
         }
         //flush the batch
         if (updateCount % batchSize != 0) {
            if (log.isTraceEnabled()) log.trace("Flushing batch, update count is: " + updateCount);
            ps.executeBatch();           
         }
         if (log.isTraceEnabled()) log.trace("Updated " + updateCount + " buckets.");
      } catch (SQLException ex) {
         //if something happens make sure buckets locks are being release
         releaseLocks(emptyBuckets);
View Full Code Here

            ps.addBatch();
            deletionCount++;
            if (deletionCount % batchSize == 0) {
               if (log.isTraceEnabled())
                  log.trace("Flushing deletion batch, total deletion count so far is " + deletionCount);
               ps.executeBatch();
            }
         }
         if (deletionCount % batchSize != 0) {
            int[] batchResult = ps.executeBatch();
            if (log.isTraceEnabled())
View Full Code Here

                  log.trace("Flushing deletion batch, total deletion count so far is " + deletionCount);
               ps.executeBatch();
            }
         }
         if (deletionCount % batchSize != 0) {
            int[] batchResult = ps.executeBatch();
            if (log.isTraceEnabled())
               log.trace("Flushed the batch and received following results: " + Arrays.toString(batchResult));
         }
      } catch (SQLException ex) {
         //if something happens make sure buckets locks are being release
View Full Code Here

        ps.setString(12, trans.getRrn());
        ps.setString(13, trans.getTxn_date());
        ps.setString(14, trans.getArea());
        ps.addBatch();
      }
      ps.executeBatch();
      conn.commit();
    } catch (SQLException e) {
      e.printStackTrace();
      if (null != conn) {
        try {
View Full Code Here

          }
          pstmt.setString(1, reader);
          pstmt.setLong(2, docid);
          pstmt.addBatch();
        }
        pstmt.executeBatch();
        pstmt.close();
       
        // Insert attachment names
        NotesItem itemAttachmentIds =
            docIndexed.getFirstItem(NCCONST.ITM_GMETAATTACHMENTDOCIDS);
View Full Code Here

              pstmt.setLong(2, docid);
              pstmt.addBatch();
              LOGGER.log(Level.FINEST,
                  "Insert attachment: {0}", attachmentId);
            }
            pstmt.executeBatch();
            pstmt.close();
          }
        }
      }
      connection.commit();
View Full Code Here

            if ((i+1) % 1000 == 0) {
                System.out.print(".");
            }
            if ((i+1) % 10000 == 0) {
                System.out.print("\n"+(i+1));
                ps.executeBatch();
                ps.close();
                con.commit();
                ps = con.prepareStatement(insert);
                ps.setQueryTimeout(0);
            }
View Full Code Here

        // with the prepareStatement() call in the main thread.
        synchronized (conn) {
          try {
            if (null != stmt) {
              if (op.execAsBatch()) {
                stmt.executeBatch();
              } else {
                stmt.execute();
              }
              stmt.close();
              stmt = null;
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.