If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Error Description

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-22-04, 02:34
jsp2999 jsp2999 is offline
Registered User
 
Join Date: Jul 2004
Posts: 76
Error Description

Hello Champs,

How can we return the error/warning description of DB2 to the calling application? (My application calls DB2 SP and I want to return SQLSTATE and related error description as output parameter of the SP)

We can get latest SQLSTATE and SQLCODE from SYSIBM.SYSDUMMY1 but what is there to get error/warning description?

I've tried by using SQLERROR but it always return blank string though it returns proper SQLSTATE as per the error. (SELECT SQLSTATE, SQLERROR INTO OUT_SQLSTATE, OUT_SQLERROR FROM SYSIBM.SYSDUMMY1

Is there any way to get error/warning description for a given SQLSTATE?

System Info:
O.S. Windows XP
DB2 V8.1.3.132, Fix Pack 3, Personal Edition.
Calling Application: .Net Program

Thanks in Advance,
Jai
Reply With Quote
  #2 (permalink)  
Old 07-24-04, 00:21
jsp2999 jsp2999 is offline
Registered User
 
Join Date: Jul 2004
Posts: 76
18 Views but no reply!!!!

Quote:
Originally Posted by jsp2999
Hello Champs,

How can we return the error/warning description of DB2 to the calling application? (My application calls DB2 SP and I want to return SQLSTATE and related error description as output parameter of the SP)

We can get latest SQLSTATE and SQLCODE from SYSIBM.SYSDUMMY1 but what is there to get error/warning description?

I've tried by using SQLERROR but it always return blank string though it returns proper SQLSTATE as per the error. (SELECT SQLSTATE, SQLERROR INTO OUT_SQLSTATE, OUT_SQLERROR FROM SYSIBM.SYSDUMMY1

Is there any way to get error/warning description for a given SQLSTATE?

System Info:
O.S. Windows XP
DB2 V8.1.3.132, Fix Pack 3, Personal Edition.
Calling Application: .Net Program

Thanks in Advance,
Jai
Reply With Quote
  #3 (permalink)  
Old 07-24-04, 15:59
GertK GertK is offline
Registered User
 
Join Date: Nov 2003
Location: Netherlands
Posts: 96
Quote:
Originally Posted by jsp2999
Hello Champs,

How can we return the error/warning description of DB2 to the calling application? (My application calls DB2 SP and I want to return SQLSTATE and related error description as output parameter of the SP)
Maybe the GET DIAGNOSTICS command can help?
Reply With Quote
  #4 (permalink)  
Old 07-24-04, 16:41
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
On DB2 for OS/390 there is a callable program to format the error message (using SQLCA as input) called DSNTIAR. It has been around for many years. This seems like a reasonable request for DB2 for LUW, but I don't know if there is such a program or funciton.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #5 (permalink)  
Old 07-26-04, 10:03
jsp2999 jsp2999 is offline
Registered User
 
Join Date: Jul 2004
Posts: 76
GET DIAGNOSTICS doesn't give error description related to SQLSTATE of the occlured error.

Is there anything exist or not for DB2 UDB 8.1.3 for LUW??
Reply With Quote
  #6 (permalink)  
Old 07-26-04, 10:32
GertK GertK is offline
Registered User
 
Join Date: Nov 2003
Location: Netherlands
Posts: 96
There's a C api which retrieves the error description, it shouldn't be a problem to create your own procedure using this API.
Reply With Quote
  #7 (permalink)  
Old 08-03-04, 10:33
jsp2999 jsp2999 is offline
Registered User
 
Join Date: Jul 2004
Posts: 76
Atlast found....

U can do it by...GET DIAGNOSTICS

GET DIAGNOSTICS EXCEPTION 1 varErrorDesc = DB2_TOKEN_STRING;

GET DIAGNOSTICS EXCEPTION 1 varErrorDesc = MESSAGE_TEXT;

Also see the details on....
http://publib.boulder.ibm.com/infoce...n/r0003272.htm
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On