Subject Re: [IBO] How to reconnect to DB II
Author Jason Wharton
> Please how can I reconnect do DB (FB1.5 RC7) when the connection has
> been lost? Beacuse the TIBODatabase.Connected property remains True, the
> only way is probably to listen to the exception.
> I implemented an TIBODatabase.OnError event handler, where it looks
> like this:
> if ERRCODE = 335544721 then begin
> Disconnect;
> Connect;
> end;
> This works pretty well except that calling Disconnect displays an
> message box 'Dataset is currently fetching' and you have to
> click 'OK' !!!
> It is necessary to avoid that dialog. I'm also not sure about the value
> 335544721 which has been discovered empiricaly.

Do NOT make any calls in the OnError event like Disconnect or Connect.
That is the wrong place to react to an error.
You should only set flags and most of the time raise an exception or allow
the default exception to be raised.

Jason Wharton