Updating Data from a Result Set

There is another interesting way to update data. You can update items in the result set and then store the updates back into the database. The ResultSet interface contains methods for updating items of various data types. The format of the various update methods is similar to the get methods, in that the update methods take either a numeric column number or a string column name. The second parameter for each update method is the value you want to store in the column. For instance, to change the value of the first _name column, use the following statement:

results.updateString("first_name", "MyName");

When you create your query statement, you must specify a result set type to let the driver know you want to update ...

Get Special Edition Using Java™ 2 Enterprise Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.