Which action can be used to load a database driver by using JDBC3.0?
Click on the arrows to vote for the correct answer
A. B. C. D.C.
The correct answer is C: Use the java.lang.Class.forName method to load the driver class.
Explanation: JDBC (Java Database Connectivity) is an API that allows Java applications to interact with databases. JDBC driver is a software component that provides an implementation of the JDBC API. JDBC drivers are provided by database vendors and are specific to a particular database. In order to use a JDBC driver, you need to load it into your application.
The java.lang.Class.forName method is used to load a class dynamically at runtime. When you use this method to load a JDBC driver class, the static initializer of the driver class is executed, which registers the driver with the DriverManager. The DriverManager is a central component that manages the JDBC drivers.
The other options are incorrect: A. Add the driver class to the META-INF/services folder of the JAR file: This is the way to specify the implementation of a service provider interface (SPI) in Java. It is not used to load JDBC drivers. B. Include the JDBC driver class in a jdbc.properties file: This is not a standard way to load JDBC drivers. It is possible that some JDBC driver vendors may provide their own way of loading the driver, but this is not part of the JDBC specification. D. Use the DriverManager.getDriver method to load the driver class: This method is used to retrieve a JDBC driver that has already been registered with the DriverManager. It is not used to load the driver in the first place.