FileDocCategorySizeDatePackage
dbtest.javaAPI DocExample890Wed Apr 05 11:25:42 BST 2000None

dbtest

public class dbtest extends Object

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

    try {
      Class.forName("oracle.jdbc.driver.OracleDriver");
      // Set the connection properties
      Properties dbProps = new Properties();
      dbProps.put("user", "libra");
      dbProps.put("password", "banana");
      //      dbProps.put("server", "dev1");
      // Get the connection from the pool
      Connection conn =
	DriverManager.getConnection("jdbc:oracle:thin:@tarazed.hbs.edu:1525:dev1", dbProps);
      Statement s = conn.createStatement();
      s.executeUpdate("insert into profile (name) values ('Jim')");
      s.close();
      conn.close();
    }
    catch (ClassNotFoundException cnfe) {
      System.out.println("Failed to load JDBC drivers.");
      cnfe.printStackTrace();
    }
    catch (Exception e) {
      e.printStackTrace();
    }