Which of the following classes is mainly used to establish a connection to the database in JDBC?
- java.sql.Connection
- java.sql.DriverManager
- java.sql.ResultSet
- java.sql.Statement
The java.sql.DriverManager class in JDBC is primarily used for establishing database connections. It provides methods like getConnection to create connections to a database server. The other classes mentioned (Connection, Statement, and ResultSet) are used after the connection is established for various database operations.
Loading...
Related Quiz
- Consider a scenario where you want to invert the sign of a numeric value only if a particular boolean condition is true. How can unary operators be utilized to achieve this without using an if statement?
- Imagine you are developing a multi-threaded application for a bank. How would you ensure that when multiple threads are trying to update the same account, the account data remains consistent?
- Which of the following classes is used to create a button in JavaFX?
- A class in Java can contain _______, which are used to describe the properties of objects.
- In a class instance, synchronized blocks can be used to avoid locking the entire method and only lock ________.