1. RR will hold share locks on all the rows accessed. The share locks will be released when the next commit takes place (either explicit or because of auto-commit).
2. The default is CS. Here is information about setting it in the CLI interface:
TXNISOLATION
Keyword Description:
Set the default isolation level.
db2cli.ini Keyword Syntax:
TXNISOLATION = 1 | 2 | 4 | 8 | 32
Default Setting:
Read Committed (Cursor Stability)
DB2 CLI/ODBC Settings Tab:
Transaction
Only Applicable when:
the default isolation level is used. This keyword will have no effect if the application has specifically set the isolation level.
Equivalent Statement Attribute:
SQL_ATTR_TXN_ISOLATION
Usage Notes:
Sets the isolation level to:
1 = Read Uncommitted (Uncommitted read)
2 = Read Committed (Cursor stability) (default)
4 = Repeatable Read (Read Stability)
8 = Serializable (Repeatable read)
32 = (No Commit, DATABASE 2 for AS/400 only; this is similar to autocommit)
To change it for the entire DB2 server, you can use the AUTOCONFIGURE command. See the Command Reference for details.
3. DB2 will try to read the rows in place, but if a sort is needed becasue of ORDER BY then DB2 may materialize the rows in a temp table (there are other reasons why DB2 may materialize the rows in a temp table).
4. You will not get any lock contention or deadlocks with UR because UR does not take any locks and ignores locks taken by others. However, for most applications CS should be sufficient. Keep in mind that multiple share locks (result of a SELECT) can coexit without any contention.
You may also need to change LOCKLIST and MAXLOCKS DB Config parms to discourage lock escalation to table level in an OLTP environment. Serach this forum for more info.