Java OCA OCP Practice Question 3093

Question

Given this code snippet:

Statement statement = connection.createStatement
        (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
ResultSet resultSet = statement.executeQuery
        ("SELECT * FROM EMPLOYEE WHERE EMPNAME = \"John\"");
resultSet.updateString("EMPNAME", "Jonathan");
// UPDATE

Assume that the variable connection points to a valid Connection object and there exists an employee record with EMPNAME value "John".

The resultSet is updated by changing the value of EMPNAME column with the value "Jonathan" instead of "John".

For this change to be reflected in the underlying database, which one of the following statements will you replace with the comment UPDATE?.

  • a) connection.updateAllResultSets();
  • b) resultSet.updateRow();
  • c) statement.updateDB();
  • d) connection.updateDatabase();


b)

Note

the call updateRow() on the ResultSet object updates the database.

other options will not compile.




PreviousNext

Related