How to tell if I can update/delete the current result set row ina ResultSet?

  • Thread starter =?ISO-8859-1?Q?Thomas_Gagn=E9?=
  • Start date
?

=?ISO-8859-1?Q?Thomas_Gagn=E9?=

I'm reviewing lesson notes on JDBC and am stumped by a comment:

* While iterating through a ResultSet you can update or delete the
current result set row from the database if:
o The DBMS & JDBC driver support updateable result sets
o The SQL statement meets the requirements for updateable
result sets:
+ The statement was created with the
ResultSet.CONCUR_UPDATABLE flag.
+ The ResultSet's methods getType() and getConcurrency()
return the types of the result set actually produced.

It's the last bullet item I don't understand. Can anyone elaborate?
 
L

Lee Fesperman

=?ISO-8859-1?Q?Thomas_Gagn=E9?= said:
I'm reviewing lesson notes on JDBC and am stumped by a comment:

* While iterating through a ResultSet you can update or delete the
current result set row from the database if:
o The DBMS & JDBC driver support updateable result sets
o The SQL statement meets the requirements for updateable
result sets:
+ The statement was created with the
ResultSet.CONCUR_UPDATABLE flag.
+ The ResultSet's methods getType() and getConcurrency()
return the types of the result set actually produced.

It's the last bullet item I don't understand. Can anyone elaborate?

When the JDBC Driver receives a createStatement() requesting specific result set type
and concurrency, it doesn't know if it can satisfy that requirement for all
executeQuery() calls under the statement. Some drivers may throw an exception on the
executeQuery(), but most will just downgrade the type and concurrency to that possible
given the actual SQL command. You can verify the actual type/concurrency for a given
result set with the above getXXX() methods, or you can just wait for an exception when
you attempt something that is not possible.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top