View previous topic :: View next topic |
Author |
Message |
Susan_Yang Beginner
Joined: 13 Feb 2006 Posts: 9 Topics: 7
|
Posted: Tue Sep 16, 2008 7:06 am Post subject: How to handle -911 issue |
|
|
I met a deadlock issue when using following logic in my PLI application program. The error is -501 which is caused by deadlock issue when preparing DYN_CURSOR_B. When -911 happens, the CURSOR_A is forced to be closed and SQL is rolled back. Thus -501 happens next time when CURSOR_A is fetched again without being opened.
1. Open CURSOR_A.
2. Fetch
3. Do while SQL = 0
Fetch CURSOR_A
Prepare DYN_CURSOR_B
...
...
END
4. Close CURSOR_A
My question is how to control the program not to enforce the CURSOR_A to be closed when -911 issue happened? So that I can handle the -911 issue by retrying to prepare DYN_CURSOR_B more than once.
Can anybody help me on that? Thanks a lot!!  |
|
Back to top |
|
 |
jsharon1248 Intermediate
Joined: 08 Aug 2007 Posts: 291 Topics: 2 Location: Chicago
|
Posted: Tue Sep 16, 2008 8:11 am Post subject: |
|
|
Your correctly stated that DB2 closes all cursors and issues a ROLLBACK when it issues a -911 sqlcode. Nothing you can do about either after DB2 issues the -911.
It seems strange that you would get a -911 on a PREPARE. Post the DB2 messages; the problem might be something else. |
|
Back to top |
|
 |
edkir98 Beginner

Joined: 27 Aug 2007 Posts: 102 Topics: 42 Location: Chennai
|
Posted: Thu Sep 18, 2008 6:49 am Post subject: |
|
|
Try using a hold cursor.
DECLARE CURSOR_A WITH HOLD FOR _________________ Thanks |
|
Back to top |
|
 |
CraigG Intermediate
Joined: 02 May 2007 Posts: 202 Topics: 0 Location: Viginia, USA
|
Posted: Thu Sep 18, 2008 7:27 am Post subject: |
|
|
edkir98 wrote: | Try using a hold cursor.
DECLARE CURSOR_A WITH HOLD FOR |
With HOLD applys to commits not to rollbacks. |
|
Back to top |
|
 |
Sqlcode Intermediate
Joined: 15 Dec 2006 Posts: 157 Topics: 38
|
Posted: Thu Sep 18, 2008 10:48 am Post subject: |
|
|
Susan_Yang,
-911 would always CLOSE your cursor.
Try to check if your program has RESTART logic and in the RESTART step you might be missing opening of CURSOR.
Also, as mentioned by jsharon1248, please paste your error messages. It seems that Error is in the LOGICAL flow of program.
Thanks, |
|
Back to top |
|
 |
|
|