1Z0-804 · Question #73
Which code fragment is required to load a JDBC 3.0 driver?
The correct answer is B. Class.forName("org.xyzdata.jdbc-NetworkDriver"). In previous versions (prior to 4.0) of JDBC, to obtain a connection, you first had to initialize your JDBCdriver by calling the method Class.forName. This methods required an object of type java.sql.Driver. DriverManager: This fully implemented class connects an application to…
Question
Which code fragment is required to load a JDBC 3.0 driver?
Options
- ADriverManager.loadDriver ("org.xyzdata.jdbc.NetworkDriver");
- BClass.forName("org.xyzdata.jdbc-NetworkDriver");
- CConnection con = Connection.getDriver
- DConnection con = DriverManager.getConnection
How the community answered
(39 responses)- A3% (1)
- B85% (33)
- C5% (2)
- D8% (3)
Explanation
In previous versions (prior to 4.0) of JDBC, to obtain a connection, you first had to initialize your JDBCdriver by calling the method Class.forName. This methods required an object of type java.sql.Driver. DriverManager: This fully implemented class connects an application to a data source, which is specified by adatabase URL. When this class first attempts to establish a connection, it automatically loads any JDBC 4.0drivers found within the class path. Note that your application must manually load any JDBC drivers prior toversion 4.0.
Topics
Community Discussion
No community discussion yet for this question.