Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old March 10th, 2006, 07:05 PM
m0002a@yahoo.com
Guest
 
Posts: n/a
Default Statement Isolation Level

Is there some way to track the isolation level of an indivual SQL
statement submitted via JDBC in a snaphot or some other similar means?
I have JDBC programs that are changing the isolation level via
Connection.setTransactionIsolation(int level) method, such as
TRANSACTION_SERIALIZABLE or TRANSACTION_REPEATABLE_READ and I need to
verify that in DB2 at a SQL statement level. I don't see isolation
level in a snapshot for Dynamic SQL.

  #2  
Old March 10th, 2006, 08:45 PM
Dave Hughes
Guest
 
Posts: n/a
Default Re: Statement Isolation Level

m0002a@yahoo.com wrote:
[color=blue]
> Is there some way to track the isolation level of an indivual SQL
> statement submitted via JDBC in a snaphot or some other similar means?
> I have JDBC programs that are changing the isolation level via
> Connection.setTransactionIsolation(int level) method, such as
> TRANSACTION_SERIALIZABLE or TRANSACTION_REPEATABLE_READ and I need to
> verify that in DB2 at a SQL statement level. I don't see isolation
> level in a snapshot for Dynamic SQL.[/color]

I'm not sure if this is what you're looking for, but the CURRENT
ISOLATION register might help you here. Take a look at

http://publib.boulder.ibm.com/infoce...om.ibm.db2.udb
..doc/admin/r0010945.htm

for more information (if that link doesn't work it's under Reference /
SQL / Language elements / Special registers / CURRENT ISOLATION in the
DB2 Info Center).

For example, VALUES CURRENT ISOLATION returns the value of the CURRENT
ISOLATION special register (usually this is blank, indicating that the
default transaction isolation level for the package / session is in
use, unless it's been changed with SET CURRENT ISOLATION).

I'm not sure how the setTransactionIsolation method alters the
transaction isolation level so this might not be any help, but it's
worth a shot.

HTH,

Dave.
--

  #3  
Old March 11th, 2006, 12:55 AM
m0002a@yahoo.com
Guest
 
Posts: n/a
Default Re: Statement Isolation Level

Dave Hughes wrote:[color=blue]
>
> I'm not sure if this is what you're looking for, but the CURRENT
> ISOLATION register might help you here. Take a look at
>
> http://publib.boulder.ibm.com/infoce...om.ibm.db2.udb
> .doc/admin/r0010945.htm
>
> for more information (if that link doesn't work it's under Reference /
> SQL / Language elements / Special registers / CURRENT ISOLATION in the
> DB2 Info Center).
>
> For example, VALUES CURRENT ISOLATION returns the value of the CURRENT
> ISOLATION special register (usually this is blank, indicating that the
> default transaction isolation level for the package / session is in
> use, unless it's been changed with SET CURRENT ISOLATION).
>
> I'm not sure how the setTransactionIsolation method alters the
> transaction isolation level so this might not be any help, but it's
> worth a shot.
>
> HTH,
>
> Dave.
> --[/color]

That is not what I am looking for. I need to see the actual isolation
level of each individual dynamic SQL statement, which can be overridden
for a given connection by "WITH RR" or other means. I also cannot
modify the code.

I ran:
db2pd -database sample -dynamic
and got some interesting output. In one section it lists the SQL
statements in package cache:

Dynamic SQL Statements:
Address AnchID StmtUID NumEnv NumVar NumRef NumExe
Text

0x40A120D0 3 1 1 1 112261 112261
SELECT JOB_LISTENER FROM QRTZ_JOB_LISTENERS WHERE JOB_NAME = ? AND
JOB_GROUP = ?

0x409EB400 10 1 1 1 49902 49902
DELETE FROM QRTZ_FIRED_TRIGGERS WHERE INSTANCE_NAME = ?

and also in another section of the report:

Dynamic SQL Environments:
Address AnchID StmtUID EnvID Iso QOpt Blk
0x40A121C0 3 1 1 RR 5 B
0x409EB4E0 10 1 1 RR 5 B
0x409AB420 22 1 1 CS 5 B
0x409ABA50 22 1 2 CS 5 B

But I cannot match up the hex addresses of the SQL statements with the
hex addresses of the Iso (isolation level). (The above is only a
partial list of the actual output).

  #4  
Old March 11th, 2006, 01:05 AM
m0002a@yahoo.com
Guest
 
Posts: n/a
Default Re: Statement Isolation Level

I just figured it out. The AnchID's match up, not the hex addresses. So
now I can determine the actual isolation level of all the SQL
statements in package cache.

  #5  
Old March 13th, 2006, 08:55 PM
Eugene F
Guest
 
Posts: n/a
Default Re: Statement Isolation Level

But I don't get this:

Address AnchID StmtUID NumEnv NumVar NumRef NumExe
Text
0x151223D0 195 1 1 1 3 1
SELECT COUNT(*) FROM t WITH
UR
....
Address AnchID StmtUID EnvID Iso QOpt Blk
0x15122490 195 1 1 CS 5 B
....

So, as you see, I ran a simple query with UR isolation explicitly
specified but db2pd indicated it was run using CS level.
Any comment?

-Eugene

  #6  
Old March 13th, 2006, 09:45 PM
m0002a@yahoo.com
Guest
 
Posts: n/a
Default Re: Statement Isolation Level

Can you open an PMR with DB2 support and report the answer here?

 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles