Recent Posts

Monday, 12 November 2018

Working with Type-2 Driver

    Oracle People provided Type-2 Driver is OCI (Oracle Call Interface) Driver. Internally OCI Driver uses OCI Native Libraries.

     OCI Driver and corresponding Native Libraries are available in the following Jar File.
ojdbc14.jar ➔ Oracle 10g (Internally Oracle Uses Java1.4V) 
ojdbc6.jar ➔ Oracle 11g (Internally Oracle Uses Java 6V) 
ojdbc7.jar ➔ Oracle 12c (Internally Oracle Uses Java 7V)
     To make Driver Software available to our Program we have to place ojdbc6.jar in Class Path. We have to collect Jar File from the following Location of Oracle Installation.
Driver Class Name : oracle.jdbc.driver.OracleDriver
JDBC URL : jdbc:oracle:oci8:@XE (until oracle 8V)
                   jdbc:oracle:oci:@XE (From Oracle 9 onwards)
where XE is SID(System ID).

     Every Database has a Unique System ID. We can find SID of our Database in the following 2 ways.
1st way
     We have to execute the following Command from SQL Plus Command Prompt
SQL> select * from global_name;

2nd way
     We can find SID from the following File
import java.sql.*;
 * @author ashok.mariyala
public class Type2DbConnectDemo { 
   public static void main(String[] args) throws Exception { 
      Connection con=DriverManager.getConnection("jdbc:oracle:oci:@XE","scott","tiger"); 
      Statement st = con.createStatement();
      ResultSet rs = st.executeQuery("select * from emp");
      while( {

Next Tutorial : Working with Type-3 Driver

Previous Tutorial : Working With Type-1 Driver

No comments:

Post a Comment