Create a scrollable and updatable ResultSet object
Statement stmt = connection.createStatement(
ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
ResultSet rs = stmt.executeQuery(
"SELECT COLUMN_1, COLUMN_2 FROM TABLE_NAME");
Move the cursor to the specific position and use related method to update data and then, call updateRow() method
rs.last();
rs.updateFloat("COLUMN_2", 25.55); // update last row's data
rs.updateRow(); // Don't miss this method, otherwise data will be lost
No comments:
Post a Comment
Note: only a member of this blog may post a comment.