473,397 Members | 2,116 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

different lock behaviour with forward only and static cursors in DB2 V9 via ODBC

Hello,

I 'm working with an IBM DB2 V9 database via ODBC/CLI.
I've got a problem with different lock behaviour in the following
constellation / configuration.

1) connection C1 and connection C2 access table T1
2) STMT1 is a statementhandle of C1 and STMT2 is a statementhandle of
C2
3) the TXN_ISOLATION_LEVEL is SQL_TXN_READ_COMMITTED (Cursor
Stability) for both connections
4) both connections work in AUTOCOMMIT_MODE
5) table T1 contains of three Rows (R1, R2, R3)

6) the two connections executes actions in the following time order:

a) C1: opens a result set / cursor with "SELECT * FROM T1"

b) C1: fetch of row R1 with open cursor on STMT1

c) C1: fetch of row R2 with open cursor on STMT1

d) C2 (!!!): DELETE-Stmt for row R2 in T1 (actually fetched by
C1,STMT1)

Now it depends on the statementHandle-configuration whether the DELETE
of R2 produces a deadlock-situation or not.

If i configure STMT1 and STMT2 as follows then it works fine and there
is no deadlock.

first config (no deadlock):
SQL_ATTR_CURSOR_SENSITIVITY set to SQL_INSENSITIVE
SQL_ATTR_CURSOR_TYPE set to SQL_CURSOR_STATIC
SQL_ATTR_CONCURRENCY set to SQL_CONCUR_READ_ONLY

But the second variant causes a deadlock.

second config (deadlock):
SQL_ATTR_CURSOR_SENSITIVITY set to SQL_INSENSITIVE,
SQL_ATTR_CURSOR_TYPE set to SQL_CURSOR_FORWARD_ONLY
SQL_ATTR_CONCURRENCY set to SQL_CONCUR_READ_ONLY

I can't use the first config because it is to slow (SQL_CURSOR_STATIC
is scrollable in DB2, that's slow).
So i have to use the first config but i can't understand the
difference of the cursor attributes that causes the deadlock.

Has anyone an idea how to use SQL_CURSOR_FORWARD_ONLY cursors without
a deadlock in the described situation?

Thanks,

Marc

Apr 13 '07 #1
0 1417

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

Similar topics

4
by: Roger Redford | last post by:
Dear Experts, I'm attempting to marry a system to an Oracle 817 datbase. Oracle is my specialty, the back end mainly, so I don't know much about java or javascript. The system uses javascript...
4
by: xeqister | last post by:
Greetings, We are connecting to a DB2 database residing on an AIX machine via JDBC. In order to lock some row of records, we use the "select . . . for update . . . " Java statement: In a...
22
by: Marc Mones | last post by:
Hello, I'working with IBM DB2 V8.1 and CLI/ODBC. I've got a problem with the following statement: ******************************************************************************** SELECT...
7
by: Sunny | last post by:
Hi, I can not understend completely the lock statement. Actally what is locked: 1. the part of the code between {...} or 2. the object in lock() In the docs is written: for 1: The lock...
0
by: Andrew Dowding | last post by:
Hi Everybody, I have been looking at problems with my Windows Forms C# application and it's little Jet 4 (Access) database for the last few days. The Windows Forms app implements a facade and...
2
by: Bob | last post by:
We currently have an application running on .NET 1.1. It hashes certain data using System.Security.Cryptography.SHA1Managed class. It has worked out fine until we upgraded the app to .NET 2.0. ...
3
by: schwartzenberg | last post by:
Dear friends, I have just run into a strange DB2 problem. Something i'd some of you would answer, if only shortly. My basic question is: How do i ensure 'insensitive' (ie static) cursors...
5
by: Marco van de Voort | last post by:
Hi, does sb recognize (aspects of) the following problem? Or better, know a solution or direction to search? At work I've inherited a series of delphi applications that access a common...
94
by: Samuel R. Neff | last post by:
When is it appropriate to use "volatile" keyword? The docs simply state: " The volatile modifier is usually used for a field that is accessed by multiple threads without using the lock...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.