// Added by Nathan Folkert: /*********************************************************************** ** ** File: /afs/ir/users/c/j/cjurney/public/cs145/SQLBatchUpdater.java ** ** Author: Craig Jurney, ITSS ** ** Written: April, 2000 ** ** Classes: SQLBatchUpdater ** ** Description: Simple template class used for updating a batch of specific rows in a single table. ** ** Maintenance: ** 04/10/00 cjurney Initial version ** **---------------------------------------------------------------------- ** Copyright (c) 2000 Board of Trustees, Leland Stanford Jr. University ************************************************************************/ import java.sql.*; public class SQLBatchUpdater { public static String USERNAME = new String("yourname"); public static String PASSWORD = new String("yourpasswd"); public static void main(String[] args) throws ClassNotFoundException { Connection con = null; // Load the Oracle Driver Class.forName("oracle.jdbc.driver.OracleDriver"); try { // Get a connection from the connection factory con = DriverManager.getConnection( "jdbc:oracle:thin:@dbaprod1:1521:SHR1_PRD", USERNAME, PASSWORD); // Show some database/driver metadata SQLUtil.printDriverInfo(con); // Create a Prepared Statement object so we can submit DML to the driver Statement stmt = con.createStatement(); // Do all updates in a single transaction con.setAutoCommit(false); // Submit the statement for (int i=0; i