by Dinesh Thakur Category: JDBC

The DriverManager class is responsible for loading the driver specific classes. The drivers are registered with the DriverManager class either when an instance of driver is created using registerDriver (Driver driver) method of the DriverManager class or DriverManager class is initialized.

The static method forName () of the Class class can be used by DriverManager class to locate and load the drivers listed in system variable jdbc.drivers is as follows.


Here, the driver class specified in the string parameter is loaded dynamically at the run time.

Some of the methods of the DriverManager are as follows.

Connection getConnection (String url): This method attempts to establish a connection to a given database URL--does not require password.

Connection getConnection(String url, String user, String password): This method attempts to establish a connection to a given database URL.

void registerDriver (Driver driver): This method is used to register a driver specified by driver with the DriverManager.

void deregisterDriver (Driver driver): This method removes the driver specified by driver from the DriverManager's list.

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.C.A, MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.