In order to avoid the disadvantages of Type-1 drivers, we have to deal with Type-4 drivers.
The only disadvantage of Type-4 is we are unable to develop 3-tier applications.
Type-4 drivers are supplied by Oracle Corporation by developing into java language. OracleDriver is the name of Type-4 driver which is released by Oracle Corporation in the form of classes111.jar
When we want to make use of Type-4 driver as a part of a java program, we must first set classpath for oracle driver by using the following:
set CLASSPATH=C:\oracle\ora92\jdbc\lib\classes111.jar;.;
For example:
Class.forName ("oracle.jdbc.driver.OracleDriver");
In order to obtain the connection from oracle database we must follow the following syntax:
For example:
Connection con=DriverManager.getConnection ("jdbc : oracle : thin :@ localhost : 1521 : pskills", "scott", "tiger")
In order to obtain port number and service ID of oracle database we must look for tnsnames.ora which is found in C:\oracle\ora92\network\admin