Examine:
Class.forName(JDBC_DRIVER_CLASS_NAME);
When is it necessary to execute this statement?
Examine:
Class.forName(JDBC_DRIVER_CLASS_NAME);
When is it necessary to execute this statement?
With the introduction of JDBC 4.0, which is included in Java 6 and later, manually loading the driver class with Class.forName() is no longer necessary. The JDBC drivers are automatically discovered and registered by scanning for service providers on the classpath, provided that the driver's JAR file is included. Thus, Class.forName(JDBC_DRIVER_CLASS_NAME); is not required to connect using the named JDBC driver.
However, since JDBC 4.0 (which is included in Java 6 and later), JDBC drivers are automatically discovered and registered by scanning for service providers on the classpath. This means that you no longer need to manually load the driver class with Class.forName() as long as the driver's JAR file is on the classpath.