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.
Add your answer
Loading...

Leave a comment

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