Multiple choice technology programming languages

Are ResultSets updateable?

  1. O (a) Yes, but only if you call the method openCursor() on the ResultSet, and if the driver and

  2. O (b) Yes, but only if you indicate a concurrency strategy when executing the statement, and

  3. O (c) Yes, but only if the ResultSet is an object of class UpdateableResultSet, and if the driver

  4. O (d) No, ResultSets are never updateable. You must explicitly execute DML statements (i.e.

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

To answer this question, the user needs to have knowledge about ResultSets and their characteristics.

Option A is incorrect because there is no openCursor() method in the ResultSet class.

Option B is partially correct. The ResultSet object is updateable only if you indicate a concurrency strategy when executing the statement, and the driver supports updateable ResultSets.

Option C is incorrect because there is no class called UpdateableResultSet in the Java API.

Option D is incorrect because ResultSets can be updateable, but it depends on the driver, the type of ResultSet, and the concurrency strategy used.

Therefore, the correct answer is:

The Answer is: B

AI explanation

A ResultSet is only updateable if you request it explicitly when creating the Statement — by specifying a concurrency mode of CONCUR_UPDATABLE (as opposed to the default CONCUR_READ_ONLY) — and the underlying JDBC driver and query must actually support that mode. There's no openCursor() method or UpdateableResultSet class in the JDBC API, and while some drivers don't support updateable result sets at all, the API itself does allow for them under the right conditions.