IBM Support

IC94283: SQLSetEnvAttr() WITH SQL_ATTR_DB2TRC_STARTUP MAY FAIL WITH SQL_INVALID_HANDLE ERROR

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • If you have an application that is calling SQLSetEnvAttr() with
    SQL_ATTR_DB2TRC_STARTUP attribute
    and you compiled this application under DB2 9.7 FP8, this same
    application may fail with SQL_INVALID_HANDLE (-2) under 10.1 FP2
    due to the way
    SQL_ATTR_DB2TRC_STARTUP is defined across those versions.
    
    From 10.1 FP2 sqlcli1.h :
    #define SQL_ATTR_DB2TRC_STARTUP_SIZE   3019
    
    
    From 9.7 FP8 sqlcli1.h :
    #define SQL_ATTR_DB2TRC_STARTUP_SIZE   3017
    
    
    Example :
    
    Compile the following program under DB2 9.7 FP8 :
    
    
    #include <sqlcli1.h>
    int main()
    {
       SQLRETURN cliRC = SQL_SUCCESS;
       cliRC = SQLSetEnvAttr(SQL_NULL_HENV,
    SQL_ATTR_DB2TRC_STARTUP_SIZE,
    (SQLPOINTER) 32, SQL_IS_UINTEGER );
    
       if (cliRC != 0)
       {
          printf(" cliRC = %d\n", cliRC);
          return cliRC;
       }
       else   printf("  OK :  %d\n", cliRC);
    
    
       return 0;
    }
    
    Execute it under DB2 9.7 FP8 :
    
    $ ./test
     cliRC = 0
    
    CLI traces show :
    
    SQLSetEnvAttr( hEnv=0:0,
    fAttribute=SQL_ATTR_DB2TRC_STARTUP_SIZE, vParam=32, cbParam=-5 )
        ---> Time elapsed - 0 seconds
    
    SQLSetEnvAttr( )
        <--- SQL_SUCCESS   Time elapsed - +3.087500E-002 seconds
    
    
    Now, if you run the same application under DB2 10.1 FP2 :
    
    $ ./test
     cliRC = -2
    
    The CLI traces show :
    
    SQLSetEnvAttr( )
        <--- SQL_INVALID_HANDLE   Time elapsed - +3.900000E-005
    seconds
    

Local fix

  • Recompile your application under the DB2 version you wish to
    execute it.
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED:                                              *
    * DB2 CLI applications                                         *
    ****************************************************************
    * PROBLEM DESCRIPTION:                                         *
    * See Error Description                                        *
    ****************************************************************
    * RECOMMENDATION:                                              *
    * Upgrade to DB2 9.7 FP9 or above                              *
    ****************************************************************
    

Problem conclusion

  • The problem was first fixed in DB2 9.7 FP9
    
    Now the define will be as #define SQL_ATTR_DB2TRC_STARTUP_SIZE
    3019
    

Temporary fix

Comments

APAR Information

  • APAR number

    IC94283

  • Reported component name

    DB2 FOR LUW

  • Reported component ID

    DB2FORLUW

  • Reported release

    970

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2013-07-22

  • Closed date

    2013-12-23

  • Last modified date

    2013-12-23

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    DB2 FOR LUW

  • Fixed component ID

    DB2FORLUW

Applicable component levels

  • R970 PSY

       UP

[{"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSEPGG","label":"DB2 for Linux, UNIX and Windows"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"9.7","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
23 December 2013