Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

IB Events: Error reading data from the connection / Cursor unknown

11 views
Skip to first unread message

Andre

unread,
Feb 8, 2008, 4:16:30 AM2/8/08
to
Recently I found the solution of weird problem, that happened
sometimes.

I have an application with 2 database threads (dbexpress), via
detouring I use the database handle for IBX so I can use Interbase
Events. All working fine, however sometimes I got all kinds of weird
errors, for example:
- General SQL error. Error reading data from the connection.
- SQL Server Error: Cursor unknown

Because I got these errors also in an other application when I used
(by accident) the same database connection in 2 threads, I realized it
could be the same reason why I got the same errors with IB events...
When you get an IB event and you directly execute a query, you get
these errors! (IB events are threads which a synchronized with the
main thread).

For example:

procedure TdmMainIBX.ibeDBEventsEventAlert(Sender: TObject;
EventName: String; EventCount: Integer; var CancelAlerts: Boolean);
begin
sqlTest.Open; //Wrong! Do not execute a
query in an IB event handler!
tmrTestTimer.Enabled := True //Better: use a timer which executes
a query async of this event
end

0 new messages