Whats the difference between the registerDriver() method and loading the driver using the Class.forName() method?
The registerDriver() method is generally called by a driver when the Class.forName() method is used to load that driver. The purpose of the method is to register the driver with the DriverManager. When the user requests a Connection using the getConnection() method on the DriverManager, the DriverManager scans the list of registered (loaded) drivers looking for the first one that recognizes the URL passed in the connection request. Developers won’t typically call the registerDriver() method unless they are actually writing their own JDBC driver.
Related Questions
- More details available to premium content service subscribers: Whats the difference between the Class.forName() method and the new operator?
- Access all premium content for $50: sign-up now. Whats the difference between the Class.forName() method and the new operator?
- Why doesn’t calling the method Class.forName load my JDBC driver?