Top Previ
ous Next Roadmap Index

Using Oracle's JDBC/OCI7


Here are the steps for using JDBC/OCI7 from a Java program:

  1. Load the driver by including the statement:
    Class.forName ("oracle.jdbc.OracleDriver")

  2. Connect to the database by including the statement:
    DriverManager.getConnection (arguments)

  3. Issue queries and receive results using standard JDBC syntax.

The method getConnection has three different forms. They differ only in the form of the parameter arguments.

The simplest form is getConnection ("URL")

The URL is of the form: jdbc:oracle:user/password@database. For example,

getConnection ("jdbc:oracle:scott/tiger");

The @database phrase is optional, because there is a default database associated with the installation.

The second form breaks URL into three string arguments. For example,

getConnection ("jdbc:oracle:","scott","tiger");

or, if you specify the database explicitly,

getConnection ("jdbc:oracle:@database","scott","tiger");

The third form relies on a Properties object. For example:

java.util.Properties info = new java.util.Properties();
info.addProperty ("user", "scott");
info.addProperty ("password","tiger");
getConnection ("jdbc:oracle:",info);


Click Here
 to Go to the top of the section

Click
 Here to Go to the previous topic

Click Her
e to Go to the next topic

Click Here to Go to the Roadmap

Click Here to Go to the Index


To report any problems or comments, email email jsqlpm@us.oracle.com .