Friday, 4 September 2015

JDBC:How do you register a driver?

There are 2 approaches for registering the Driver:
  • Class.forName(): This method dynamically loads the driver's class file into memory, which automatically registers it. This method is preferable because it allows you to make the driver registration configurable and portable.
  • DriverManager.registerDriver(): This static method is used in case you are using a non-JDK compliant JVM, such as the one provided by Microsoft.

No comments:

Post a Comment