By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,334 Members | 1,290 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,334 IT Pros & Developers. It's quick & easy.

DB2 v9 Win x64 crash

P: n/a
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:
Mar 17 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.