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 multi user environment, we find that once a user locks the rows of
records, another user executing the "select ... for update . . . "
statement will wait, until the first user "commits" the transaction, so
that the rows will be unlocked.
Please let us know if there is a 'Non blocking" locking mechanism,
whereby, if the rows are locked, the statement fails with an
appropriate error message that could be traped, so that the application
could behave accordingly.
We understand that some database supports a "nowait" option, in the
"select" statement, i.e. "select for update, nowait . . . ". Is there
something equivalent in DB2?
Thanks in advance.. 4 6010
<xe******@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com... 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 multi user environment, we find that once a user locks the rows of records, another user executing the "select ... for update . . . " statement will wait, until the first user "commits" the transaction, so that the rows will be unlocked.
Please let us know if there is a 'Non blocking" locking mechanism, whereby, if the rows are locked, the statement fails with an appropriate error message that could be traped, so that the application could behave accordingly.
We understand that some database supports a "nowait" option, in the "select" statement, i.e. "select for update, nowait . . . ". Is there something equivalent in DB2?
Thanks in advance..
The default setting for LOCKTIMEOUT in the db config is -1, which means that
DB2 will wait forever (unless a deadlock occurs). You can change that to the
number of seconds you want to wait before a -911 occurs. However, an
automatic rollback may occur with the transaction that gets the -911, so
test it to make sure it behaves as desired.
Hello,
a possible way to prevent your appl from either waiting for a lock or
failing with SQLCODE -911 (which includes an undesired rollback), you could
try to declare a static sensitive scrollable cursor to process your desired
rowset. Scrollable cursors use a kind of optimistic locking mechanism which
does not lock the original rows anymore after OPEN. If you update a row
within the open scrollable cursor then, but another process has already
updated this row in the meantime, your appl still gets an error sqlcode
(-224 afaik), but it will NOT be rolled back and thus can still decide what
do do now instead...
Regards - Walter.
<xe******@gmail.com> schrieb im Newsbeitrag
news:11**********************@g14g2000cwa.googlegr oups.com... 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 multi user environment, we find that once a user locks the rows of records, another user executing the "select ... for update . . . " statement will wait, until the first user "commits" the transaction, so that the rows will be unlocked.
Please let us know if there is a 'Non blocking" locking mechanism, whereby, if the rows are locked, the statement fails with an appropriate error message that could be traped, so that the application could behave accordingly.
We understand that some database supports a "nowait" option, in the "select" statement, i.e. "select for update, nowait . . . ". Is there something equivalent in DB2?
Thanks in advance.. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: xixi |
last post by:
can someone explain to me what is internal p lock, internal s lock,
internal v lock? when i have IS lock or IX lock , i always have these
internal locks together for the application handle
...
|
by: Bruce Pullen |
last post by:
DB2 v7.2 (FP7 - DB2 v7.1.0.68) on AIX 5.2.0.0.
We're seeing unexpected single row (then commit) insert locking
behaviour.
We're seeing Applications that already hold row-level W locks in...
|
by: Christoph Zeltner |
last post by:
hi,
i am writing a thesis on the concurrency control in db2 udb and oracle. I
found in the documentary of db2, that
a resource holding a (U)pdate-Lock can still be requested by a read-lock...
|
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...
|
by: Nashat Wanly |
last post by:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaskdr/html/askgui06032003.asp
Don't Lock Type Objects!
Why Lock(typeof(ClassName)) or SyncLock GetType(ClassName) Is Bad
Rico...
|
by: Raj |
last post by:
I created a refresh deferred MQT, and during full refresh there were 4
or 5 lock waits, all waiting on a 'S' lock on Internal Catalog Cache ?
Can some one explain how to prevent this from happening?
|
by: shenanwei |
last post by:
DB2 V8.2 on AIX, type II index is created.
I see this from deadlock event monitor.
5) Deadlocked Connection ...
Participant no.: 2
Lock wait start time: 09/18/2006 23:04:09.911774
.........
|
by: blangela |
last post by:
If you had asked me 5 years ago about the future of C++, I would have
told you that its future was assured for many years to come. Recently,
I have been starting to wonder.
I have been teaching...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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,...
|
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...
|
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...
|
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,...
| |