Which statement is true about the DriverManager class?
Click on the arrows to vote for the correct answer
A. B. C. D.A.
https://javaconceptoftheday.com/drivermanager-class-in-java/The DriverManager class in Java is a part of the JDBC (Java Database Connectivity) API that provides a standard interface to connect to a database. It manages the establishment of connections between a Java application and a database using a driver. Here are the answers to the question:
A. It returns an instance of a database. This statement is incorrect because the DriverManager class does not return an instance of the database. It provides a standard interface to connect to a database using a driver.
B. It executes SQL statements against the database. This statement is incorrect because the DriverManager class is not responsible for executing SQL statements against the database. The Connection and Statement classes in the JDBC API are responsible for executing SQL statements.
C. It loads the database driver class mentioned in the jdbc.drivers property. This statement is partially correct. The DriverManager class loads the database driver class mentioned in the jdbc.drivers property if it is set. However, it also searches for the driver class in the classpath if the property is not set.
D. It is written by different vendors for their specific database. This statement is incorrect because the DriverManager class is a part of the JDBC API, which is a standard interface for connecting to any database. The driver classes are written by different vendors for their specific database management systems.
In conclusion, the correct answer is C. The DriverManager class loads the database driver class mentioned in the jdbc.drivers property or searches for the driver class in the classpath if the property is not set.