Subject RE: [IBO] Invalid cursor declaration Statement already has a cursor assigned
Author IBO Support List

This sounds like a very odd issue. Nothing immediately comes to mind.

Perhaps you could at least jump up to the recent updated version of the
evaluation version I just put out. Please do this and let me know how it
goes. I just barely uploaded it to the web-site so there may not yet be
other changes reflecting this. But, the file should be considerably larger
because I included all of the files necessary for C++ Builder support.


-----Original Message-----
From: [] On Behalf
Of Debora
Sent: Friday, August 23, 2013 2:00 AM
Subject: [IBO] Invalid cursor declaration Statement already has a cursor


I'm currently writing a set of unit tests for our product CopyCat (cf., in which I cycle through all our supported connector
and perform a series of tests. Since we support IBObjects, I have been
trying to get my tests to work with it, but I am getting a very strange
error message when preparing a query : "Invalid cursor declaration Statement
already has a cursor XXX assigned". I am of course not declaring any cursors
or doing anything exotic, I am merely executing a series of SQL statements,
and strangely, it doesn't always bomb out on the same query...

The code is too long to post here, but what I'm doing is basically :

- Creating an instance of a TDataModule descendant containing a CopyCat IBO
connector. Interally, this connector creates an instances of TIB_Connection
and TIB_Transaction, and one instance of TIBOQuery for every query.

- I then automatically create a new database (using

- I create a table called TEST.

- I create the CopyCat replication tables and triggers.

- I insert some data.

- I replicate using CopyCat (to another database created the same way).

- I then check to see if the data has been correctly replicated.

In most cases, it fails while creating the replication triggers. But it's
not always the same place, and if I put a break-point and step through it,
it usually works!

One thing is that since my SQL is dynamically created, I use the same
TIBOQuery object many times. I simply Close, UnPrepare, change the SQL, and
Open again. So it could be that TIBOQuery is creating a cursor at some point
and it doesn't get freed correctly when unprepared, or something like

So my question is two-fold :

1) Do you have any idea what I might be doing wrong ?

2) If not, do you have any idea what I might do differently to work around
this problem. I suspect that I don't need the cursor that IBO is creating
anyway (I need a very simple, readonly, unidirectional SQL query object with
no frills), so maybe there are options I can disable so as to work around
this problem. I know I could use TIB_Query instead (in fact, I used to do
so), but TIBOQuery allows me to get the field values as a simple Variant
(and let IBO figure out how to make that Variant) whereas with TIB_Query I
had to do it all by hand, and it was causing some problems with certain
data-types (can't remember which).

FWIW, I'm using a fresh download of the latest IBO (evaluation) version, in
Delphi XE2.

Thanks in advance for your help.

Jonathan Neve.


IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________ - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !
Yahoo! Groups Links