473,699 Members | 2,887 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Isolation level ignored when DTC is used

Hello everyone

We have a bunch of components registered under COM+ with 'transaction
required' option.

On the client we are using iSeries Access 5.2.0, with all possible
fixes applied (Service level SI16136, iSeries ODBC driver version
9.00.09.00).

Server is DB2/AS400 05.02.0001 (that's what ODBC driver reports. So, I
guess it's V5R2.1 or something like this). Server is actually outside
our control (belongs to customer). We can suggest some changes to the
customer, but first we need to understand what's going on.

Here's what happens (I stripped tables and statements to the bone):

1) Before tests, we create a table. Like this
Create table test
(ID integer primary key,Node integer,Q integer)

2) and insert two records:
INSERT into test (id, node, q) values (11, 1, 0)
INSERT into test (id, node, q) values (12, 1, 1)

3) Now we call component A. It establishes a connection to our DB2,
which is enlisted into DTC.

4) Component A does an update:
UPDATE test SET q=0 WHERE id=12

5) Component A continues... In this example, it just goes to sleep.

6) At this point, of course, the second record is locked and 'dirty'.
So, should another transaction see it? Depends on isolation level,
right? We set Isolation level for DSN as 'Repeatable Read (*ALL)'.

7) Component B (transaction B) is called
SELECT * from TEST where node=1 and q=0

8) It returns an EMPTY recordset. It beats me, why it does not return
the first record (11, 1, 0).

Since I don't know much about DB2, I tried the same client, same
components, same settings, but against a different database. This one
is also a V5R2, but full version number is 05.02.0009.

In this case component B sensibly waits till transaction A ends, and
then returns only the first record! That's what I expect from it!

Does any DB2 guru here know
- What should we look into? Server config? Network config? Any clues in
trace files?
- Does 05.02.0001 support all the isolation levels?
- Are there any known issues between 5.2.0001 and MS DTC that make it
desirable to upgrade the server to 5.2.0009?

Thank you in advance
Yury Shatz
(yury.shatz@__n ospam__.usa.net )

Nov 12 '05 #1
9 2909
"yu_sha" <yu********@usa .net> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
Hello everyone

We have a bunch of components registered under COM+ with 'transaction
required' option.

On the client we are using iSeries Access 5.2.0, with all possible
fixes applied (Service level SI16136, iSeries ODBC driver version
9.00.09.00).

Server is DB2/AS400 05.02.0001 (that's what ODBC driver reports. So, I
guess it's V5R2.1 or something like this). Server is actually outside
our control (belongs to customer). We can suggest some changes to the
customer, but first we need to understand what's going on.

Here's what happens (I stripped tables and statements to the bone):

1) Before tests, we create a table. Like this
Create table test
(ID integer primary key,Node integer,Q integer)

2) and insert two records:
INSERT into test (id, node, q) values (11, 1, 0)
INSERT into test (id, node, q) values (12, 1, 1)

3) Now we call component A. It establishes a connection to our DB2,
which is enlisted into DTC.

4) Component A does an update:
UPDATE test SET q=0 WHERE id=12

5) Component A continues... In this example, it just goes to sleep.

6) At this point, of course, the second record is locked and 'dirty'.
So, should another transaction see it? Depends on isolation level,
right? We set Isolation level for DSN as 'Repeatable Read (*ALL)'.

7) Component B (transaction B) is called
SELECT * from TEST where node=1 and q=0

8) It returns an EMPTY recordset. It beats me, why it does not return
the first record (11, 1, 0).

Since I don't know much about DB2, I tried the same client, same
components, same settings, but against a different database. This one
is also a V5R2, but full version number is 05.02.0009.

In this case component B sensibly waits till transaction A ends, and
then returns only the first record! That's what I expect from it!

Does any DB2 guru here know
- What should we look into? Server config? Network config? Any clues in
trace files?
- Does 05.02.0001 support all the isolation levels?
- Are there any known issues between 5.2.0001 and MS DTC that make it
desirable to upgrade the server to 5.2.0009?

Thank you in advance
Yury Shatz
(yury.shatz@__n ospam__.usa.net )

DB2/400 is a sometimes different from the other DB2's, and not many DB2/400
experts post here, but here a few comments on your post based on DB2 in
general (not specifically DB2/400).

Isolation level determines how long read (share) locks are held.. It has no
effect on update locks, which are always held until a commit or rollback
takes place. Of curse, isolation level UR (uncommitted read) ignores most
locks. With repeatable read, share locks are also held until a commit
occurs.

Are you sure that your component B is not receiving an SQL error (such as
lock timeout) during the select?
Nov 12 '05 #2
> Of curse, isolation level UR (uncommitted read) ignores most
locks. With repeatable read, share locks are also held until a commit
occurs. I realize this. So, I fully expected my 'select' component to block on
a locked row and wait for transaction A to end. Which is what happens
on another database.
Are you sure that your component B is not receiving an SQL error (such as lock timeout) during the select?

Well, I am certainly not getting any error from ADODB. I am even
getting a recordset with the fields (but no rows). I've never seen
ADODB or ODBC 'hiding' error from the client so it is safe to assume
the database actually returns this recordset.

When I turned iSeries diagnostic tools on, I did not see anything
suspicious in the log, either.

Do you know where I can find some sort of change log between V5R2.0001
and V5R2.0009?

Nov 12 '05 #3
> 8) It returns an EMPTY recordset. It beats me, why it does not return
the first record (11, 1, 0).


What it beats me is why it doesn't timeout
With a RR isolation and 2 rows in the table, i think the access plan will
try a shared lock at the table level, which will conflict with the X lock on
the updated record.
I don't think there is any way that you can fetch anything from that table
at RR unless you create some index and make the optimizer use it
Nov 12 '05 #4
Don't know about DB2/400. If like db2 udb for LUW, suppose db2/400 also
supports statment isolation level, you should try using this way to re-run
the test. Sometimes for whatever reason, when you set the isolation level
for the whole session or the whole transaction, it might not take effect and
it is hard for you to verify. I tried to find out the isolation level of a
java program and finally gave up.
The second thing is you should check if the isolation level RR for ODBC does
match db2/as400's isolation level RR. Just like standard JDBC API which can
talk to DBMS from different vendor. The under ODBC driver will take care of
the conversion.

"yu_sha" <yu********@usa .net> wrote in message
news:11******** *************@f 14g2000cwb.goog legroups.com...
Of curse, isolation level UR (uncommitted read) ignores most
locks. With repeatable read, share locks are also held until a commit
occurs.

I realize this. So, I fully expected my 'select' component to block on
a locked row and wait for transaction A to end. Which is what happens
on another database.
Are you sure that your component B is not receiving an SQL error

(such as
lock timeout) during the select?

Well, I am certainly not getting any error from ADODB. I am even
getting a recordset with the fields (but no rows). I've never seen
ADODB or ODBC 'hiding' error from the client so it is safe to assume
the database actually returns this recordset.

When I turned iSeries diagnostic tools on, I did not see anything
suspicious in the log, either.

Do you know where I can find some sort of change log between V5R2.0001
and V5R2.0009?

Nov 12 '05 #5
> What it beats me is why it doesn't timeout
You are right, of course. It should timeout. I tried RR, ALL and CS
isolation levels, with the same results. With CHG isolation level it
returns both rows, this makes sense.
With a RR isolation and 2 rows in the table, i think the access plan will try a shared lock at the table level, which will conflict with the X lock on the updated record.
By the way, if I insert 10000 rows, nothing changes.
I don't think there is any way that you can fetch anything from that table at RR unless you create some index and make the optimizer use it

It's OK if it blocks. This is a low priority loop on the server that
looks for the next jobs to execute - it'll fetch something next time.

I started investigating this when query (more complex than this one)
returned 'both' rows - including a dirty one - under RR isolation
level. Which is completely unacceptable. Empty recordset is acceptable,
but weird and I believe it to be manifestation of the same problem.

By the way, on Oracle and MS SQL we use SKIP LOCKED hint for this
purpose. No such think on DB2, as far as I understand?

Nov 12 '05 #6
> Sometimes for whatever reason, when you set the isolation level
for the whole session or the whole transaction, it might not take effect and it is hard for you to verify.


I though about that, but writing "WITH RR" or "WITH ALL" or "WITH CS"
on the end of SELECT gives exactly the same results.

By the way, "Read Uncommitted" works differently so Isolation Level
does have some effect.

<<The second thing is you should check if the isolation level RR for
ODBC does match db2/as400's isolation level RR>>
That's actually a DB2 iSeries ODBC driver's setting. So I guess it
matches.

What I was thinking is - perhaps this database does not support these
high isolation levels at all, because it's an old version or because
it's configured that way. How do I find out?

Nov 12 '05 #7
yu_sha wrote:
What it beats me is why it doesn't timeout

You are right, of course. It should timeout.


It depends on the configuration of the lock-timeout. If that is still set
to -1, then DB2 will wait until the universe collapses (or an interrupt is
received). In other words, it won't time-out.

--
Knut Stolze
Information Integration
IBM Germany / University of Jena
Nov 12 '05 #8

"yu_sha" <yu********@usa .net> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.com.. .
Sometimes for whatever reason, when you set the isolation level
for the whole session or the whole transaction, it might not take

effect
and it is hard for you to verify.


I though about that, but writing "WITH RR" or "WITH ALL" or "WITH CS"
on the end of SELECT gives exactly the same results.

By the way, "Read Uncommitted" works differently so Isolation Level
does have some effect.

<<The second thing is you should check if the isolation level RR for
ODBC does match db2/as400's isolation level RR>>
That's actually a DB2 iSeries ODBC driver's setting. So I guess it
matches.

What I was thinking is - perhaps this database does not support these
high isolation levels at all, because it's an old version or because
it's configured that way. How do I find out?


The easier way to do this - you just need to cature the explain information
of a simple query, like the following:
"select * from <tbl> where <colname> = 'xxx' with rr"
from db2 command line.
Then from the explain output, you can find out the isolation level
information.
Nov 12 '05 #9
It does not wait it does not timeout - it quickly returns results that
are wrong.

Nov 12 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
12707
by: Markus Breuer | last post by:
I have a question about oracle commit and transactions. Following scenario: Process A performs a single sql-INSERT into a table and commits the transaction. Then he informs process B (ipc) to read the new date. So process B starts "select ..." but does not get the previously inserted row. The timespan between commit and select is very short. (NOTE: two different sessions are used) Questions: 1.) Does commit when returning from call...
0
1842
by: pulsar | last post by:
Hello, We use db2connect and DRDA to communicate between an AS400 and DB2 UDB V7.2. We have a new needs with an AS400 library that we already used with the isolation level "CS"; now we want to use it sometime with isolation level "UR" in an application an sometimes with isolation level "CS" as usual. We don't use ODBC over db2connect, only db2connect. The command "db2 change isolation to UR" works correctly in the windows command but...
2
8849
by: klh | last post by:
We use DB2 Connect v 7.2 FP7 in Windows NT hitting a OS/390 DB2 v7.1 database. We have a Websphere (java) application that issues dynamic SQL. Most of the time when we issue dynamic SQL SELECT statements, like through a DB2 command window, the command will be processed using a package like SQLLF000 which uses an isolation level of Cursor Stability. However sometimes in the Websphere application when a dynamic SELECT statement is issued...
3
8670
by: Eric Porter | last post by:
Dear All, I have a VB6.COM program using a VB6.COM DLL, which in turn uses ADODB that performs various bits of SQL. I have re-written the VB6.COM DLL in C#.NET (with a VB6 shell), which uses the ADODB.Interop library supplied with .NET. The VB6.COM program above calls this C#.NET library in an effort to perform the equivalent functionality.
2
8133
by: kanda | last post by:
Hello. I am developing the application (VBA&ODBC, to be exact) which periodically calls the stored procedures in the IBM DB2. A few of the procedures require executing with isolation level RR ( ANSI "SERIALIZABLE" ), not the default; default is CS (ANSI "Read Committed")). The procedure language is SQL. According to the documentation, I can adjust procedure *run*-time isolation level by setting *compile*-time dataserver-wide option
5
3347
by: m0002a | last post by:
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.
3
2235
by: kavallin | last post by:
I'm confused about isolation level.. According to the devleoper of our app (java, running java stored procedures) dont they have any setTransactionIsolation in there code so the default should be CS but ... running db2pd -app -dyn shows that RS is used .. Is it something special you have to consider when building the procs ? I'm using this to build the procs sqlj ${PROCEDURE}.sqlj db2sqljcustomize -url...
3
3270
by: RG | last post by:
How can I lookup the current isolation level? Thanks in advance
3
3828
by: Maryan | last post by:
Hi everybody, there are two ways to change the isolation level: For instance i would like to change the isolation level to rs 1. "db2 change isolation to rs" 2. "db2 set current isolation rs" When i use the first one and then "db2 values current isolation" to verify if the change was successful, i won't get anything. But when i use the second one and then invoke the command "db2 values current isolation", i will see that the...
0
8704
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8623
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9192
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8939
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7778
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6545
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5879
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4390
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2362
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.