DB2 - Problem description
| Problem IC94283 | Status: Closed |
SQLSetEnvAttr() WITH SQL_ATTR_DB2TRC_STARTUP MAY FAIL WITH SQL_INVALID_HANDLE ERROR | |
| product: | |
DB2 FOR LUW / DB2FORLUW / 970 - DB2 | |
| Problem 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 | |
| Problem Summary: | |
**************************************************************** * USERS AFFECTED: * * DB2 CLI applications * **************************************************************** * PROBLEM DESCRIPTION: * * See Error Description * **************************************************************** * RECOMMENDATION: * * Upgrade to DB2 9.7 FP9 or above * **************************************************************** | |
| Local Fix: | |
Recompile your application under the DB2 version you wish to execute it. | |
| available fix packs: | |
DB2 Version 9.7 Fix Pack 9 for Linux, UNIX, and Windows | |
| Solution | |
The problem was first fixed in DB2 9.7 FP9 Now the define will be as #define SQL_ATTR_DB2TRC_STARTUP_SIZE 3019 | |
| Workaround | |
not known / see Local fix | |
| Timestamps | |
Date - problem reported : Date - problem closed : Date - last modified : | 22.07.2013 23.12.2013 23.12.2013 |
| Problem solved at the following versions (IBM BugInfos) | |
9.7.FP9 | |
| Problem solved according to the fixlist(s) of the following version(s) | |
| 9.7.0.9 |
|
| 9.7.0.9 |
|