Subject Re: [IBO] How to reconnect to DB II
Author Andreas Bednarek
> Yes, there are various errcodes that indicate a lost connection.
> I can't specifically remember but I have them in a ConnectionWasLost list.
> Please snoop the sources and let me know if you can't find it. I'd find it
> now but I'm hoppin busy.
>
> Jason

Hello Jason,
I found the following function in IB_Session.pas:

function ConnectionLostErrcode( const AErrCode: integer ): boolean;
begin
Result := ( AErrCode = isc_shutdown ) or
( AErrCode = isc_lost_db_connection ) or
( AErrCode = isc_network_error ) or
( AErrCode = isc_net_connect_err ) or
( AErrCode = isc_net_connect_listen_err ) or
( AErrCode = isc_net_event_connect_err ) or
( AErrCode = isc_net_event_listen_err ) or
( AErrCode = isc_net_read_err ) or
( AErrCode = isc_net_write_err );
end;



Shall I use the result of this function to know whether or not I must call

Disconnect;
Connect;

to make an attempt to reconnect to database? Or just take some subset of
those codes (like calling only Disconnect on isc_shutdown or so)?

Seems my problem might be solved soon. :-)

Thank you
Andreas

(P.S. for those who also search for how to solve this, the codes mentioned
above are defined in IB_Header.pas)


>
> ----- Original Message -----
> From: "Andreas Bednarek" <bluehorse@...>
> To: <IBObjects@yahoogroups.com>
> Sent: Friday, January 23, 2004 2:27 AM
> Subject: Re: [IBO] How to reconnect to DB II
>
>
> > > >
> > > > if ERRCODE = 335544721 then begin
> > > > Disconnect;
> > > > Connect;
> > > > end;
> > > >
> > >
> > > 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
> > > www.ibobjects.com
> >
> > Thanks for the tip Jason, good to know that. Do I have to track another
> > ERRCODE values than the mentioned 335544721, too? I mean for the case
that
> > connection was lost and I should try to reconnect?
> >
> > Thanks
> > Andreas
>
>
>
___________________________________________________________________________
> IB Objects - direct, complete, custom connectivity to Firebird or
InterBase
> without the need for BDE, ODBC or any other layer.
>
___________________________________________________________________________
> http://www.ibobjects.com - your IBO community resource for Tech Info
papers,
> keyword-searchable FAQ, community code contributions and more !
>
> Yahoo! Groups Links
>
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/IBObjects/
>
> To unsubscribe from this group, send an email to:
> IBObjects-unsubscribe@yahoogroups.com
>
> Your use of Yahoo! Groups is subject to:
> http://docs.yahoo.com/info/terms/
>
>