Updatable result sets in Derby can be updated by using result set update methods (updateRow(),deleteRow() and insertRow()), or by using positioned update or delete queries.
Both scrollable and non-scrollable result sets can be updatable in Derby.
If the query which was executed to create the result set is not updatable, Derby will downgrade the concurrency mode to ResultSet.CONCUR_READ_ONLY, and add a warning about this on the ResultSet. The compilation of the query fails if the result set cannot be updatable, and contains a FOR UPDATE clause.
Positioned updates and deletes can be performed if the query contains FOR UPDATE or if the concurrency mode for the result set is ResultSet.CONCUR_UPDATABLE.
To use the result set update methods, the concurrency mode for the result set must be ResultSet.CONCUR_UPDATABLE. The query does not need to contain FOR UPDATE to use these methods.
Updatable cursors lock the current row with an update lock when positioned on the row, regardless of isolation level. Therefore, to avoid excessive locking of rows, only use concurrency mode ResultSet.CONCUR_UPDATABLE or the FOR UPDATE clause when you actually need to update the rows. For more information about locking, see Types and scope of locks in Derby systems.