Oracle Driver or Thin Driver Loading in JDBC | Java JDBC Tutorial

This Java JDBC Tutorial “Oracle Thin driver loading in JDBC” post explains clearly how to load Oracle given JDBC driver to connect with DBMS application from the java application.


 

Type-4 (Oracle Driver):

  • Given by Oracle Corporation.
  • Used to connect with DBMS application (with Oracle only).
  • Implementing java.sql.Driver interface.
  • Using “sun-driver” we can interact with “n” number of DBMS application but only from java application.
  • Using “oracle-driver” we can interact with only Oracle-DBMS application from different languages.
  • These drivers are independent to all the Operating Systems. Hence we can use from any OS.

 

Where Oracle-Driver is available?

  • When we install Oracle application, ojdbc-jar file will be installed in the Application location.
  • Ojdbc-jar contains implemented Driver interface is called “OracleDriver” class.
  • Once we install Oracle application, we can locate OracleDriver.class in ojdbc jar file.

 

class-path:

  • “Classpath” is nothing but providing information in environment variables about jar files used to java application.
  • To develop basic core java applications classes available in “rt.jar” file.
  • To work with jar files, class path is mandatory.
  • No need to set class path to rt.jar file.To develop server side programming and to work with jars available in Oracle application, class path settings compulsory.
  • To work with external jars(user defined jars and downloaded from internet), class path is mandatory

 

Connection String for Type-4 Driver :

String is “jdbc:oracle:thin:@localhost:1521”;

jdbc : jdbc application is interacting with
oracle : oracle application using driver
thin : “thin” driver(another name to oracle driver)
:@localhost : the system in which oracle driver is available
:1521 : the port number at which oracle application is running.

 

 

Share this