Sun Driver Loading in JDBC | Java JDBC Tutorial

This Java JDBC Tutorial  “Sun Driver Loading in JDBC” explains clearly how to load type-1 driver or Sun driver in JDBC application and how to register with DriverManager class.


Sun Driver Loading:

We can load the driver and register with driver in two ways:



  • The most common approach to register a driver is to use Java’s Class.forName() method to dynamically load the driver’s class file into memory.
  • Loaded driver will be automatically register with DriverManager.
  • This method is preferable because it allows you to make the driver registration configurable and portable.
  • The following example uses Class.forName( ) to register the Oracle driver:


DriverManager class contains following Method to return Connection object.


Following Program explains clearly how to Load and Register with DriverManager:




  • Using static method of DriverManager class, we can load the Driver explicitly.
  • The second approach to register the Driver explicitly.
  • You should use the registerDriver() method if you are using a non JDK compliant JVM, such as the one provided by Microsoft.


Share this