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

DB2 Execute Immediate

P: 17
My environment
DB2 9.1.4 on Sun OS

I write a C embedded SQL to load data.

I declare host vars as:
EXEC SQL BEGIN DECLARE SECTION;
SQL TYPE IS CLOB(599999) sqlStr;
EXEC SQL END DECLARE SECTION;

then set sqlStr and execute sqlStr as

sprintf(sqlStr.data, "%s, %d, %d, '%s')", staticStr, recId, seqno, data);
sqlStr.length = strlen(sqlStr.data);
EXEC SQL EXECUTE IMMEDIATE :sqlStr;

my staticStr contains table name, column names in run time and "data" can contains very long string. "data" is also inserted into a clob column in the table specified inside staticStr.

The compilation is OK but in execution I get this error:

EXECUTE IMMEDIATE ERROR: SQLCODE: -805 SQLSTATE 51002: The package corresponding to an SQL statement execution request
was not found.

Does this mean I am missing a DB2 library in during compilation ??
I check and -805 means "The DBRM or package name not found in plan"

What does this mean ????
Please help. Thanks
Feb 6 '08 #1
Share this Question
Share on Google+
3 Replies


P: 17
I figured it out. It has something to do with the BIND process.
To solve the problem, deverlopers have to make sure that:

1. the makefile points to the right database.
2. correct db id/ password uses to connect to database during compilation.
3. in C code, the EXEC SQL CONNECT must also have the USER id USING pwd portion.

That will solve the mysterious -805 and 51002 code.
Please correct if I am wrong
Feb 6 '08 #2

sakumar9
Expert 100+
P: 127
I am not sure if you have binded the package. (this is what the error says).
After precompilation, there will be one *.bnd file. You need to bind this package with DB2. You can use "db2 BIND <bindfilename.bnd>" command to bind the package.


Let me know if you still have this error,


Regards
-- Sanjay
Feb 7 '08 #3

P: 17
I did bind but bound to the wrong objects. The error message is quite ambiguous.
Everything is all right now.
Feb 12 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.