FileDocCategorySizeDatePackage
TestInstallJDBC.javaAPI DocExample1016Fri Oct 01 15:08:04 BST 1999None

TestInstallJDBC

public class TestInstallJDBC extends Object

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

    Connection conn=null;;
    PreparedStatement ps=null;
    ResultSet rs=null;

    /* if you're using a non-Oracle JDBC Driver, add a call here to
	DriverManager.registerDriver() to register your Driver
    */

    // set the default connection to the URL, user, and password
    // specified in your connect.properties file
    Oracle.connect(TestInstallJDBC.class, "connect.properties");

    conn = DefaultContext.getDefaultContext().getConnection();

    conn.prepareStatement("DELETE FROM SALES").executeUpdate();
    conn.prepareStatement(
	"INSERT INTO SALES(ITEM_NAME) VALUES ('Hello JDBC!')").executeUpdate();

    ps = conn.prepareStatement("SELECT ITEM_NAME FROM SALES");
    rs = ps.executeQuery();

    while (rs.next()) {
      System.out.println(rs.getString(1));
    }