We help IT Professionals succeed at work.

DB2 isolation level with JDBC

LeTay
LeTay used Ask the Experts™
on
What are the way(s) to change the isolation level accessing a DB2 database via the JDBC driver ?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
you can either change the isolation property at the connection method, and this isolation will hold for every statement you execute, or you can change the isolation level at the statement level by adding with XX at the end of the statement, for example

select * FROM mytable with CS
select * from mytable with UR

Author

Commented:
I was told that I can also change the db2cli.ini file
Is this true ?
What do I have to put there ?
Do you have a sample ?

Author

Commented:
I forgot to mention : the application can access DB2 or Oracle or mySQL (depends on our customer needs) so better to have the isolation level specified "outside" the code of the application
Kent OlsenData Warehouse / Database Architect

Commented:
Hi LeTay,

Depending on the client that you're using to access DB2, you can also change the default isolation level.

  SET ISOLATION LEVEL UR/CS/etc.


Kent

Author

Commented:
We use JDBC
I think that I have to modify db2cli.ini
Data Warehouse / Database Architect
Commented:
Hi LeTay,

  http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/admin/t0005269.htm


The page discusses setting the isolation level.  Step 5 describes setting it for a JDBC driver via the db2cli.ini file.


Kent