Error from EXEC SQL OPEN?!

Error from EXEC SQL OPEN?!

Post by David Dawkin » Thu, 22 Mar 2001 03:28:17



Hi,

My app does the following:

-----------------------------------------------------------------------
 EXEC SQL DECLARE C1 CURSOR FOR SELECT REC_KEY,
  convert(char(23),REC_TIME, 21 ),
  MYHEADER,
  FIELDCOUNT,
  F0,
  F1
  FROM MY_QUEUE ORDER BY REC_TIME;

 if (SQLCODE != 0) {
    fprintf( stderr, "SQL DECLARE ERROR: %d:%s\n", SQLCODE, SQLERRMC );
    return -1;
 }

 EXEC SQL OPEN C1;

 if (SQLCODE != 0) {
    fprintf( stderr, "SQL OPEN ERROR: %d:%s\n", SQLCODE, SQLERRMC );
    return -1;
 }
------------------------------------------------------------------------

I get an error back from the OPEN statement:

Quote:> SQL OPEN ERROR: -16945:The cursor was not declared.

I'm stuck. Why does it think my cursor is not declared? I did notice that
the generated .c file contains no sqlxxx calls for the EXEC SQL DECLARE;
the definition appears to be embedded in the calls generated for EXEC SQL
OPEN. I don't know if this is relevant or not.

Any pointers or clues gratefully received!!

nsqlprep reports:

Quote:> Microsoft (R) Embedded SQL for C Pre-Compiler. Version 7.00.623.
> Copyright (c) Microsoft Corp 1993-1998. All rights reserved.

Regards,
David Dawkins
 
 
 

1. SQL Exec /Cmd Exec Fails

CmdExec Backups are not running even though SQL Executive appears to be
running.  When I attempt to run one of the scheduled tasks I am getting the
following error message: "DBLib Message Handler: Login failed- User: sa
Reason: Not associated with a trusted SQL Server connection." also "DBLib
Error Handler: Login incorrect".

Please help.

2. Access 97 SQL 7 Trusted Connection

3. SQL EXEC syntax errors

4. SQL Server ENTERPRISE Edition -- Service Packs

5. sql server 6.5 backup exec errors

6. Exists in v$session, not in v$process

7. SQL exec Error

8. <no subject>

9. EXEC SQL TASK - Error

10. Catching Trigger Errors from dynamic SQL exec

11. sql server 6.5 backup exec errors

12. SQL Restores - Veritas Backup Exec - Error

13. SQL Exec Error Log