Coding a JDBC Connection

You can establish a database connection in pure JDBC code.

To code a JDBC Connection:

  1. Import the JDBC classes using the statement
    import java.sql.*;
    

    This statement is required for all JDBC programming.

  2. Register the Oracle JDBC drivers with the Driver Manager using the statement
    DriverManager.registerDriver
        (new oracle.jdbc.driver.OracleDriver());
     
  3. Get a connection to a data server using the statement calling one of the getConnection methods:
    Connection conn = DriverManager.getConnection(parameters...);
    

    There are three driver manager getConnection methods, differing in the number and types of their parameters.

For more information, see the Oracle9i JDBC Developer's Guide and Reference. This document is available online at the Oracle Technology Network (OTN) website, at otn.oracle.com/docs/products/oracle9i/content.html.


Embedding SQL in Java Programs with JDBC
Configuring Database Connections
Registering a New Third-Party JDBC Driver
Connection Requirements for Oracle's Type 2 JDBC Drivers (OCI)