The DriverManager class acts as an interface between user and drivers. It keeps track of the drivers that are available and handles establishing a connection between a database and the appropriate driver. The DriverManager class maintains a list of Driver classes that have registered themselves by calling the method DriverManager.registerDriver().
Commonly used methods of DriverManager class:
- public static void registerDriver(Driver driver): is used to register the given driver with DriverManager.
- public static void deregisterDriver(Driver driver): is used to deregister the given driver (drop the driver from the list) with DriverManager.
- public static Connection getConnection(String url): is used to establish the connection with the specified url.
- public static Connection getConnection(String url,String userName,String password): is used to establish the connection with the specified url, username and password.
For example of DriverManager follow below links:
- 5 JDBC Steps to Connect with Database
- JDBC: Connection With Oracle Database
- JDBC Connection with MySQL Database
- JDBC: List of Drivers for Databases
- JDBC: Drivers Types and Uses
Learn More on JDBC
Follow below links to learn more on JDBC and solving JDBC related issues :
You must log in to post a comment.