Hi,
Just FYI
The following (incorrect) embedded code is crashing DB2 v9 fixpack 2 and
below on Windows x64
Exactly, the statement
EXEC SQL SET CURRENT PACKAGESET :garbage
returns SQLCODE 0, but any statement after that makes DB2 to do segmentation
fault with a lot of dumps...
Regards,
Sergey
----------------------------------------------------------------------
#include <sqlenv.h>
#include <sqlutil.h>
#include <string.h>
#include <stdio.h>
EXEC SQL INCLUDE sqlca;
EXEC SQL BEGIN DECLARE SECTION;
static char user[16];
static char pass[32];
static char alias[16];
EXEC SQL END DECLARE SECTION;
int main(int ac, char ** av) {
EXEC SQL BEGIN DECLARE SECTION;
char garbage[30];
EXEC SQL END DECLARE SECTION;
strcpy(user, "ME");
strcpy(pass, "mypass");
strcpy(alias, "DBNAME");
memset(garbage, 0xC2, 29);
garbage[29] = 0;
EXEC SQL CONNECT TO :alias USER :user USING :pass;
if(sqlca.sqlcode != 0) {
printf("DB CONNECT errcode = %d, error: %.70s\n", sqlca.sqlcode,
sqlca.sqlerrmc);
return -1;
}
printf("setting pkg to '%s'\n", garbage);
EXEC SQL SET CURRENT PACKAGESET :garbage;
if(sqlca.sqlcode != 0) {
printf("SET CURRENT PACKAGESET schema errcode = %d, error: %.70s\n",
sqlca.sqlcode, sqlca.sqlerrmc);
}
EXEC SQL SET SCHEMA = :user;
if(sqlca.sqlcode != 0) {
printf("SET SCHEMA errcode = %d, error: %.70s\n",
sqlca.sqlcode, sqlca.sqlerrmc);
}
EXEC SQL ROLLBACK WORK;
if(sqlca.sqlcode != 0) {
printf("ROLLBACK errcode = %d, error: %.70s\n",
sqlca.sqlcode, sqlca.sqlerrmc);
return -1;
}
return 0;
}
---------------------------
The result is:
setting pkg to 'ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ'
SET SCHEMA errcode = -1224, error:
ROLLBACK errcode = -1024, error: