Working With Type 2 Driver

Working With Type 2 Driver

In this tutorial, we are going to discuss about Working With Type 2 Driver. Oracle People provided Type-2 Driver is OCI (Oracle Call Interface) Driver. Internally OCI Driver uses OCI Native Libraries.

Working With Type 2 Driver

OCI Driver and corresponding Native Libraries are available in the following Jar File.

ojdbc14.jar ➔ Oracle 10g (Internally Oracle Uses Java 1.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



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( {

That’s all about the Working With Type 2 Driver in JDBC. If you have any queries or feedback, please write us email at Enjoy learning, Enjoy Java.!!

Working With Type 2 Driver
Scroll to top