Which code fragment is required to load a JDBC 3.0 driver?
A.
DriverManager.loadDr iver (“org.xyzdata.jdbc.NetworkDriver”);
B.
Class.forName(“org.xyzdata.jdbc-NetworkDriver”);
C.
Connection con = Connection.getDriver
(“jdbc:xyzdata://localhost:3306/EmployeeDB”);
D.
Connection con = DriverManager.getConnection
(“jdbc:xyzdata://localhost:3306/EmployeeDB”);
Explanation:
In previous versions(prior to 4.0)of JDBC, to obtain a connection, you first had to initialize your JDBC driver by calling the method Class.forName. This methods required an object of type java.sql.Driver.Note:
DriverManager: This fully implemented class connects an application to a data source, which is specified by a database URL. When this class first attempts to establish a connection, it automatically loads any JDBC 4.0 drivers found within the class path. Note that your application must manually load any JDBC drivers prior to version 4.0.
B
D. in JDBC 3.0 Applications no longer need to explicitly load JDBC drivers using Class.forName().
correction it is in JDBC 4.0