FileDocCategorySizeDatePackage
UpdateLogic.javaAPI DocExample1652Tue Aug 22 18:18:22 BST 2000None

UpdateLogic

public class UpdateLogic extends Object
Example 3.4.

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

    Connection con = null;

    if( args.length != 2 ) {
      System.out.println("Syntax: <java UpdateLogic [number] [string]>");
      return;
    }
    try {
      String driver = "com.imaginary.sql.msql.MsqlDriver";

      Class.forName(driver).newInstance();
      String url = "jdbc:msql://carthage.imaginary.com/ora";
      Statement s;

      con = DriverManager.getConnection(url, "borg", "");
      con.setAutoCommit(false);  // make sure auto commit is off!
      s = con.createStatement();// create the first statement
      s.executeUpdate("INSERT INTO test (test_id, test_val) " +
                      "VALUES(" + args[0] + ", '" + args[1] + "')");
      s.close();                    // close the first statement
      s = con.createStatement();    // create the second statement
      s.executeUpdate("INSERT into test_desc (test_id, test_desc) " +
                      "VALUES(" + args[0] + 
                      ",