Author |
Message
|
wcrausch |
Posted: Wed May 22, 2002 12:31 pm Post subject: DB2 ODBC Error SQL0514 "Cursor not in Prepared State&qu |
|
|
Novice
Joined: 28 Aug 2001 Posts: 17 Location: Denver, CO
|
Has anyone seen the following error (Application Log):
Database error: SQL State '26501'; Native Error Code '-514'; Error Text '[IBM][CLI Driver][DB2/NT] SQL0514N The cursor "SQLCUR4" is not in a prepared state. SQLSTATE=26501
Error executing SQL statement 'SELECT COUNT(*) FROM MQSIUID.PRODUCT T WHERE (T.PRNBR)=(?)' against datasource 'MAPPING' with parameters ''95001050', '.
I am running MQSi 2.0.2 (DB2 v7.1) on Windows NT 4 and am trying to read a local database.
Thanks for any help you can provide.
Bill |
|
Back to top |
|
 |
TorpedoSTu |
Posted: Thu May 23, 2002 6:13 am Post subject: |
|
|
Acolyte
Joined: 14 Nov 2001 Posts: 73
|
Wotcher,
2 things
Generally the syntax is (I know it's daft but ....)
Select col,col from Database.Schema.DbName as X where X.col = condition)
So your ESQL should read ....
Set CounVar = THE (Select Count(*) from Database.Product as T where T.PRNBR = Var);
If you've got the syntax correct then I apologise.
second thing, make sure that ..
a: you've defined the Db to ODBC as a system datasource and
b: you've bound the Db to the DB2CLI ...
db2 bind c:\sqllib\bnd\@db2cli.lst blocking all grant public clipkg 5 |
|
Back to top |
|
 |
wcrausch |
Posted: Thu May 23, 2002 6:17 am Post subject: |
|
|
Novice
Joined: 28 Aug 2001 Posts: 17 Location: Denver, CO
|
What does the bind statement do? |
|
Back to top |
|
 |
TorpedoSTu |
Posted: Thu May 23, 2002 6:37 am Post subject: |
|
|
Acolyte
Joined: 14 Nov 2001 Posts: 73
|
It binds DB2 to the DB2CLI (Call Level. Interface).
You should do this for all db2 databases that u use with WMQI |
|
Back to top |
|
 |
wcrausch |
Posted: Thu May 23, 2002 6:56 am Post subject: |
|
|
Novice
Joined: 28 Aug 2001 Posts: 17 Location: Denver, CO
|
Should I do the bind or must I? I ask because most of the time, everything works okay. It is only once in a while I have problems.
Also, does it matter if it MQSi and not WMQI? |
|
Back to top |
|
 |
TorpedoSTu |
Posted: Thu May 23, 2002 7:13 am Post subject: |
|
|
Acolyte
Joined: 14 Nov 2001 Posts: 73
|
I would alway bing the Db to the CLI and no, it makes no difference for MQSI or WMQI as it's the same thing really. |
|
Back to top |
|
 |
Outdesign |
Posted: Fri May 24, 2002 12:21 am Post subject: |
|
|
Apprentice
Joined: 16 Sep 2001 Posts: 38 Location: Hampshire, UK
|
To clarify the bind point ...
-> If you use the DB Control Center "Create Database Wizard" to create your
database then do *NOT* need to explicity perform the database bind.
-> If you use the DB2 Command Line Processor to issue the create database command
then you *DO* need to perform the database bind.
-> Refer to page 44 of the Websphere MQ Integrator for Windows NT and Windows 2000
Installation Guide under the heading "Binding the CLI package to the database".
Note, this is applicable to MQSIv2.0.* versions as well.
Quote: |
Should I do the bind or must I? I ask because most of the time, everything works
okay. It is only once in a while I have problems.
|
-> Is your user database different to your broker database ?
-> The only once in a while when you have problems, is then when you access this
user database ? Or can you access this database elsewhere in your flows sucessfully ?
-> Your actual ESQL statement would be useful
FYI :
SQL0514N The cursor "<name>" is not in a prepared state.
Explanation: The application program tried to use a cursor "<name>" that is not
in a prepared state. The cursor is associated with a statement that either (1)
was never prepared, (2) was made not valid by a ROLLBACK, or (3) was made not valid
by either an explicit or implicit rebind of the package.
The statement cannot be processed.
User Response: For case (1), prepare the statement named in the DECLARE CURSOR statement
for "<name>" before you try to open the cursor. For case (2), do not issue a ROLLBACK
until after you finish using the cursor. For case (3), the prepare for the cursor must
be reissued.
|
|
Back to top |
|
 |
|