IBM Support

IC68198: SQLFREEHANDLE() for environment handle in CLI application returns -1 on DB2 V9.7 FP1

Subscribe

You can track all active APARs for this component.

APAR status

  • Closed as program error.

Error description

  • SQLFreeHandle() for environment handle in CLI application
    returns 0 on DB2 V9.7 GA.
    However, it returns -1 on DB2 V9.7 FP1.
    
    We can reproduce this issue.
    Here is a part of the application code and its result.
    
    $ cat cli01.c
    ...(snip)...
    int main(int argc, char *argv[])
    {
    ...(snip)...
      printf("\n  Disconnecting from %s...\n", dbAlias);
      cliRC = SQLDisconnect(hdbc);
      DBC_HANDLE_CHECK(hdbc, cliRC);
    .
      printf("  Disconnected from %s.\n", dbAlias);
    .
      /* free connection handle */
      cliRC = SQLFreeHandle(SQL_HANDLE_DBC, hdbc);
      DBC_HANDLE_CHECK(hdbc, cliRC);
    .
      /* free environment handle */
      cliRC = SQLFreeHandle(SQL_HANDLE_ENV, henv);
      printf("cliRC = [%d]\n", cliRC);
      ENV_HANDLE_CHECK(henv, cliRC);
    .
      return rc;
    } /* main */
    
    
    
    This problem occurs only when we build it as 32-bit application
    on
    V9.7 FP1. like the following(badcase):
    
      xlc -I/home/v97fp1/sqllib/include -c cli01.c
    
      xlc -o cli01 cli01.o -L/home/v97fp1/sqllib/lib32 -ldb2
    
    
    
    On the other hand, this problem does not occur if we compile it
    as 64-bit.
    
    Application issues SQLFreeHandle twice. The first one for
    SQL_HANDLE_DBC succeeds with rc 0, but the second one for
    SQL_HANDLE_ENV gets RC -1 even though cli trace shows
    SQL_SUCCESS.
    

Local fix

Problem summary

  • ****************************************************************
    * USERS AFFECTED:                                              *
    * V97 FP1 or FP2 user                                          *
    ****************************************************************
    * PROBLEM DESCRIPTION:                                         *
    * SQLFreeHandle() for environment handle in CLI application    *
    *                                                              *
    * returns 0 on DB2 V9.7 GA.                                    *
    *                                                              *
    * However, it returns -1 on DB2 V9.7 FP1.                      *
    * Problem occurs only when we build it as 32-bit application   *
    * on                                                           *
    * V9.7 FP1.                                                    *
    * On the other hand, this problem does not occur if we compile *
    * it as 64-bit.                                                *
    ****************************************************************
    * RECOMMENDATION:                                              *
    * Upgrade to DB2 Version 9.7 Fix Pack 3.                       *
    ****************************************************************
    

Problem conclusion

  • Problem was first fixed in V9.7 FP3.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IC68198

  • 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

    2010-04-26

  • Closed date

    2010-10-03

  • Last modified date

    2010-10-03

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

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

    IC68787

Fix information

  • Fixed component name

    DB2 FOR LUW

  • Fixed component ID

    DB2FORLUW

Applicable component levels

  • R970 PSN

       UP



Document information

More support for: DB2 for Linux, UNIX and Windows

Software version: 9.7

Reference #: IC68198

Modified date: 03 October 2010