You are here:   HomeJava ProgrammingJDBCJDBC - DriverManager Class
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.

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver")

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.





Subscribe To Free Daily Newsletter!

Get Free News Updates Delivered Directly To Your Inbox
About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular Computer Notes 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.



What's New and Popular