DB2 10.5 for Linux, UNIX, and Windows
Specifying the isolation level
Because the isolation level determines how data is isolated from other processes while the data is being accessed, you should select an isolation level that balances the requirements of concurrency and data integrity.
About this task
The isolation level that you specify is in effect for
the duration of the unit of work (UOW). The following heuristics are
used to determine which isolation level will be used when compiling
an SQL or XQuery statement:
- For static SQL:
- If an isolation-clause is specified in the statement, the value of that clause is used.
- If an isolation-clause is not specified in the statement, the isolation level that was specified for the package when the package was bound to the database is used.
- For dynamic SQL:
- If an isolation-clause is specified in the statement, the value of that clause is used.
- If an isolation-clause is not specified in the statement, and a SET CURRENT ISOLATION statement has been issued within the current session, the value of the CURRENT ISOLATION special register is used.
- If an isolation-clause is not specified in the statement, and a SET CURRENT ISOLATION statement has not been issued within the current session, the isolation level that was specified for the package when the package was bound to the database is used.
- For static or dynamic XQuery statements, the isolation level of the environment determines the isolation level that is used when the XQuery expression is evaluated.
Note: Many commercially-written applications provide a method
for choosing the isolation level. Refer to the application documentation
for information.
The isolation level can be specified in several different ways.