MCQ: Which of the following method is static and synchronized in JDBC API?



Which of the following method is static and synchronized in JDBC API?

  1. getConnection()
  2. prepareCall()
  3. executeUpdate()
  4. executeQuery()

Answer

a. getConnection()

Explanation:

A Java application using the JDBC API establishes a connection to a database by obtaining a Connection object. 

The standard way to obtain a Connection object is to call the method DriverManager.getConnection() method that accepts a String containing the database connection URL. So getConnection() method is a static and synchronized method.

Free Spring Boot Tutorial - 5 Hours Full Course


Watch this course on YouTube at Spring Boot Tutorial | Fee 5 Hours Full Course

Comments