Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2004
    Posts
    76

    Unanswered: 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

  2. #2
    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

  3. #3
    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?

  4. #4
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    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

  5. #5
    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??

  6. #6
    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.

  7. #7
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •