OCP Question 29, Explanation

Which statement is true about the DriverManager class?

A. It returns an instance of Connection.
B. It executes SQL statements against the database.
C. It only queries metadata of the database.
D. It is written by different vendors for their specific database.

 

The correct answer is A.

 

The DriverManager class is actually a part of JDK (it lives in the java.sql package) and serves to manage a set of JDBC drivers, so option D misses the point, and option C is out, too.

As to the execution of SQL statements, this job is reserved for a bunch of overloaded execute() methods that can be called on a Statement object created by invoking any of the overloaded createStatement() methods defined in the Connection class. The static Connection object follows a Singleton pattern and is made available through an overloaded static DriverManager.getConnection() method.

Leave Comment

Your email address will not be published. Required fields are marked *