473,383 Members | 1,716 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,383 software developers and data experts.

Can DB2 do a select with a TimeOut if it takes too long?

We have a case where we want to attempt to do some processing, but if
the records are currently locked, we'd like to avoid processing (for
now, and move on to something else until the records are unlocked).

The problem is: how do we manage this?

If there was a way to check if the record was locked, that would be
ideal (i.e., ask, its locked, do something else).

Alternatively, if we could do a modification/locking action, and the
engine waits for a certain time and then times out on us, that would
also work.

Are any of these options available in DB2?

Thanks,
Chris

Jan 26 '07 #1
6 7808
Ahh, never mind. It appears that in 8.2, you can set the CURRENT LOCK
TIMEOUT by session to achieve what we want.

-Chris

Jan 26 '07 #2
ChrisC wrote:
We have a case where we want to attempt to do some processing, but if
the records are currently locked, we'd like to avoid processing (for
now, and move on to something else until the records are unlocked).

The problem is: how do we manage this?

If there was a way to check if the record was locked, that would be
ideal (i.e., ask, its locked, do something else).

Alternatively, if we could do a modification/locking action, and the
engine waits for a certain time and then times out on us, that would
also work.

Are any of these options available in DB2?
SET CURRENT LOCK TIMEOUT
http://publib.boulder.ibm.com/infoce...c/r0011874.htm

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Jan 26 '07 #3
Ian
ChrisC wrote:
Ahh, never mind. It appears that in 8.2, you can set the CURRENT LOCK
TIMEOUT by session to achieve what we want.
Also note you can set the LOCKTIMEOUT database configuration parameter
to control the default timeout for all connections.

I'd suggest that setting CURRENT LOCK TIMEOUT explicitly should be the
exception, not the rule.
Jan 26 '07 #4
Ian wrote:
ChrisC wrote:
>Ahh, never mind. It appears that in 8.2, you can set the CURRENT LOCK
TIMEOUT by session to achieve what we want.

Also note you can set the LOCKTIMEOUT database configuration parameter
to control the default timeout for all connections.

I'd suggest that setting CURRENT LOCK TIMEOUT explicitly should be the
exception, not the rule.
Note that the lock timeout begins ticking for each lock. So if you want to
limit the overall execution time of a statement, use two threads in your
app: one thread executes the statement, and the other can be used to cancel
the execution when you deem it to take too long.

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Jan 29 '07 #5
Hi.

On Jan 29, 11:43 am, Knut Stolze <sto...@de.ibm.comwrote:
Note that the lock timeout begins ticking for each lock. So if you want to
limit the overall execution time of a statement, use two threads in your
app: one thread executes the statement, and the other can be used to cancel
the execution when you deem it to take too long.
This is still only available via a command line connection, right?
You can't force applications from within SQL yet (in standard DB2, at
least), right?

Thanks,
Chris

Jan 29 '07 #6
ChrisC wrote:
On Jan 29, 11:43 am, Knut Stolze <sto...@de.ibm.comwrote:
>Note that the lock timeout begins ticking for each lock. So if you want
to limit the overall execution time of a statement, use two threads in
your app: one thread executes the statement, and the other can be used to
cancel the execution when you deem it to take too long.
This is still only available via a command line connection, right?
You can't force applications from within SQL yet (in standard DB2, at
least), right?
I'm referring to functions like SQLCancel() in CLI (aka ODBC). JDBC has
something similar.

You cannot "cancel" an execution from the command line as far as I know.
You can only force a connection, which terminates the SQL session - not
just the statement being executed.

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Jan 30 '07 #7

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

Similar topics

7
by: Tyler | last post by:
I have an asp page that is producing a report via some heavy SQL queries with dynamically chosen parameters from the users of the page. I can run it on my development server (takes about 35...
4
by: Ram Baruch | last post by:
Hi, I have a question: I made a windows service (using VS wizard). All it does is to connect to my site every X seconds and check if there is anything new to download. If there is- it downloads a...
12
by: Geigho | last post by:
Setting session timeout in web.config file does not seem to have any effect. Any explanation or suggestion will be appreciated.
2
by: PCH | last post by:
I have a page in asp.net (vb.net) that does some background processing. the user enters info on the aspx page and clicks run. That goes to the codebehind to do data/file work. It can take up...
2
by: Solel Software | last post by:
Hello I have a SQL Server 2000 database query that takes a long time (about 1.5 min in SQL Query Analyser) that I am running from a web page. I keep getting a Timeout error regardless of how long...
1
by: Christopher DeMarco | last post by:
Hi all... I've written a class to provide an interface to popen; I've included the actual select() loop below. I'm finding that "sometimes" popen'd processes take "a really long time" to...
2
by: R3al1ty | last post by:
ASP.NET, Windows Forms, Web Services WebService Proxy Timeout = 100secs WebService Asmx = Unlimited? IIS ASP ScriptTimeout = 90secs IIS ASP.NET Execution Timeout = 110secs SQL CommandTimeout...
5
vinci
by: vinci | last post by:
hello everyone! I have this WebApp that takes too long to process. Basically, it reads an excel template and writes on it(hope you got the idea). When i run it in my PC(Dev Unit), everything works...
2
by: JimLad | last post by:
Hi, I've got a very basic asp.net page that accesses a very slow db query and siplays to screen. I'm hitting a timeout aftre about 3.5 to 4.5 minutes - seems to be variable. SQL connection...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.