JDBC ResultSet Update Record with Refresh Row

JDBC ResultSet Update Record with Refresh Row


Refresh Row JDBC

One of the new features of JDBC 2.0 is the introduction of updateXXX() methods in ResultSet interface. With these methods, without using SQL commands, a record in the table can be updated, inserted, deleted and now let us see updating a record with refreshRow() method.

In the following code, a record’s old salary is retrieved, then updated and then new salary is again retrieved and printed. Once the data is updated, the operation is committed with commit() method of Connection interface.

Example on Refresh Row JDBC using refreshRow()

con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);

The above statement is explained in ResultSet Types and Concurrency.

The updateXXX() methods are discussed in Scrollable ResultSet.

Pass your comments and suggestions on this tutorial "Refresh Row JDBC" to improve quality.

Leave a Reply

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