471,072 Members | 1,017 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,072 software developers and data experts.

DB2 Execute Immediate

My environment
DB2 9.1.4 on Sun OS

I write a C embedded SQL to load data.

I declare host vars as:
SQL TYPE IS CLOB(599999) sqlStr;

then set sqlStr and execute sqlStr as

sprintf(sqlStr.data, "%s, %d, %d, '%s')", staticStr, recId, seqno, data);
sqlStr.length = strlen(sqlStr.data);

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
3 6688
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
127 Expert 100+
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,

-- Sanjay
Feb 7 '08 #3
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.

Similar topics

4 posts views Thread by finlma | last post: by
3 posts views Thread by Agoston Bejo | last post: by
1 post views Thread by lakon15 | last post: by
3 posts views Thread by Rahul Babbar | last post: by
6 posts views Thread by Oliver | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.