import java.sql.*;
class jdbcTransactions3batch {
  public static void main (String args [])
   throws SQLException {
 // Oracle-Treiber laden
 DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
 // Verbindung zur Datenbank herstellen
 String url = "jdbc:oracle:thin:@oracle11.informatik.uni-goettingen.de:1521:dbis";
 Connection conn1 = DriverManager.getConnection(url,"scott","tiger");
 conn1.setAutoCommit(false);
 Statement stmt1 = conn1.createStatement();
 stmt1.execute("DROP TABLE TTEST");
 stmt1.execute("CREATE TABLE TTEST(A VARCHAR2(7))");
 stmt1.execute("COMMIT");

 PreparedStatement pstmt1 = conn1.prepareStatement("INSERT INTO TTEST VALUES(?)");
 pstmt1.setString(1, "BLA");
 pstmt1.execute();

 for (int i=1; i<100; i++) { 
  pstmt1.setString(1, "BLA"+i);
  pstmt1.addBatch();
  System.out.println(i);
 }
 
 pstmt1.executeBatch();
 pstmt1.close();
 stmt1.close();
 conn1.close();

}}
