473,789 Members | 3,084 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

error trapping in select

I have a condition in which I have to ignore an error while SELECTING.
The error is lock timeout (Db2 error code -911). When fetchrow_arrayr ef

fetches the locked row, I do get -911 which I trap in my code. When I
move on to the next row doing another fetchrow_arrayr ef, I get error -3
(no statement executing). Does that mean that fetchrow_arrayr ef
will stop processing at the first error and there is no way to continue
to the next stop, ignoring it.

DB2 gurus: Is there a way to tell DB2 while SELECTING to ignore rows
which are locked by another session.

thanks.

Jan 19 '07 #1
7 2430
<dc********@aim .comwrote in message
news:11******** **************@ 11g2000cwr.goog legroups.com...
>I have a condition in which I have to ignore an error while SELECTING.
The error is lock timeout (Db2 error code -911). When fetchrow_arrayr ef

fetches the locked row, I do get -911 which I trap in my code. When I
move on to the next row doing another fetchrow_arrayr ef, I get error -3
(no statement executing). Does that mean that fetchrow_arrayr ef
will stop processing at the first error and there is no way to continue
to the next stop, ignoring it.

DB2 gurus: Is there a way to tell DB2 while SELECTING to ignore rows
which are locked by another session.

thanks.
You can append WITH UR on the end of the select to not take any locks, and
to ignore all locks taken by others.

There are some slightly less drastic measures that can be used to minimize
lock contention, but not completely eliminate it like you can by using WITH
UR.
Jan 19 '07 #2
Mark A wrote:
You can append WITH UR on the end of the select to not take any locks, and
to ignore all locks taken by others.

There are some slightly less drastic measures that can be used to minimize
lock contention, but not completely eliminate it like you can by using WITH
UR.
I am aware of this, but I can't use this if I end up with
a phantom row (that is a row which I read but
rolled back subsequently). That is a BIG no in my
case.

Is there a way to get an indication from DB2 that
I am reading an uncomitted row. If I can get that,
then I can store it for the time being and then
revisit later to double check.

Jan 19 '07 #3
<dc********@aim .comwrote in message
news:11******** **************@ q2g2000cwa.goog legroups.com...
>
I am aware of this, but I can't use this if I end up with
a phantom row (that is a row which I read but
rolled back subsequently). That is a BIG no in my
case.

Is there a way to get an indication from DB2 that
I am reading an uncomitted row. If I can get that,
then I can store it for the time being and then
revisit later to double check.
I think you can use
SET CURRENT LOCK TIMEOUT 0
to immediately get -911 back if the row is locked, but to actually see the
data, you will need to issue another SELECT and use WITH UR.
Jan 19 '07 #4
Mark A wrote:
I think you can use
SET CURRENT LOCK TIMEOUT 0
to immediately get -911 back if the row is locked, but to actually see the
data, you will need to issue another SELECT and use WITH UR.
after -911 error fetchrow_arrayr ef stops further processing.

Jan 19 '07 #5
dc********@aim. com wrote:
I have a condition in which I have to ignore an error while SELECTING.
The error is lock timeout (Db2 error code -911).
Could you provide the complete error message? SQL0911 is for lock timeouts
and deadlocks. The reason code would tell us which of the two cases
occurs, and the counter-measures will heavily depend on that.
When fetchrow_arrayr ef
fetches the locked row, I do get -911 which I trap in my code. When I
move on to the next row doing another fetchrow_arrayr ef, I get error -3
(no statement executing). Does that mean that fetchrow_arrayr ef
will stop processing at the first error and there is no way to continue
to the next stop, ignoring it.
Given that you are also posting to a Perl NG, I assume your application is
written in Perl?

Note that PHP has the rather stupid default behavior to query DB2 using FOR
UPDATE. Specifying FOR READ ONLY explicitly often helps a lot with locking
issues. Maybe something similar applies to Perl as well?
DB2 gurus: Is there a way to tell DB2 while SELECTING to ignore rows
which are locked by another session.
There are settings like DB2_SKIPDELETED , DB2_SKIPINSERTE D, and
DB2_EVALUNCOMMI TTED. Maybe changing those (read in the manual for their
exact implications) could help as well?

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Jan 21 '07 #6
Knut Stolze wrote:
>DB2 gurus: Is there a way to tell DB2 while SELECTING to ignore rows
which are locked by another session.

There are settings like DB2_SKIPDELETED , DB2_SKIPINSERTE D, and
DB2_EVALUNCOMMI TTED. Maybe changing those (read in the manual for their
exact implications) could help as well?
I can't check the FM at the moment, but last I looked the DBD::DB2
driver supported a limited subset of connection and statement
attributes. For example, a few years ago I had to hack in code to
handle settings for distributed transactions (not sure if this ever made
it into the code base, although I submitted it to the maintainer).

Steve
Feb 24 '07 #7
Ian
Steven N. Hirsch wrote:
Knut Stolze wrote:
>>DB2 gurus: Is there a way to tell DB2 while SELECTING to ignore rows
which are locked by another session.

There are settings like DB2_SKIPDELETED , DB2_SKIPINSERTE D, and
DB2_EVALUNCOMM ITTED. Maybe changing those (read in the manual for their
exact implications) could help as well?

I can't check the FM at the moment, but last I looked the DBD::DB2
driver supported a limited subset of connection and statement
attributes. For example, a few years ago I had to hack in code to
handle settings for distributed transactions (not sure if this ever made
it into the code base, although I submitted it to the maintainer).
Those settings are instance-level configuration parameters, so you don't
have to worry about setting them at the application level.
Feb 26 '07 #8

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

Similar topics

3
3285
by: Michael | last post by:
Hello again everyone, Hope you can help. I have a form with a lot of code going on in the background but I can't find the route cause of the following error message. Update or Cancel Update Without Add New or Edit. I understand that when trying to update records you have to work
13
6617
by: deko | last post by:
I use this convention frequently: Exit_Here: Exit Sub HandleErr: Select Case Err.Number Case 3163 Resume Next Case 3376 Resume Next
6
4754
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much appreciated. Thanks in advance
3
6902
by: Nathan Bloomfield | last post by:
Hi there, I am having difficulty with a piece of code which would work wonders for my application if only the error trapping worked properly. Basically, it works as follows: - adds records from rsSource into rsDest - if it finds a key violation then it deletes the current record from rsDest and adds the new record from rsSource. This works perfectly - but only for the first found duplicate record, it brings up the error
4
9449
by: Keith | last post by:
I have the following code in the On No Data event of a report: **** On Error GoTo err_trap MsgBox "No items matching criteria.", vbInformation, gcApplication Cancel = True err_trap: If Err.Number = 2501 Then Exit Sub
13
4486
by: Thelma Lubkin | last post by:
I use code extensively; I probably overuse it. But I've been using error trapping very sparingly, and now I've been trapped by that. A form that works for me on the system I'm using, apparently runs into problems on the system where it will actually be used, and since I used so little error-trapping it dies very ungracefully. I will of course try to fix whatever is causing the error and add error-trapping to the functions where the...
2
3880
by: Captain Nemo | last post by:
I'm still using Office 2000 myself, but some of my clients have Office 2003. I've recently added a piece of code to create an instance of Word, open a document, fill in the blanks and become visible so the document can be printed and/or modified. This all takes place within one form, in which the Word.Application and Word.Document objects are both private form-level variables. Just to be on the safe side I included this piece of code in...
3
5191
by: Jim Armstrong | last post by:
Hello all - This is driving me crazy. I have a table called tblClients - very simple, has the following fields: taxID (PK) ClientName SalesName The main form of my application allows a user to select a client and
2
19494
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
0
2897
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
0
9665
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
9511
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
10408
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...
0
10199
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10139
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
9983
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7529
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
5417
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...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.