Subject Re: [IBO] Disconnect Troubles
Author Jason Wharton
You need to rollback all transactions and disconnect the database and then
attempt to connect again.

Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com


----- Original Message -----
From: "Paul Irwin" <paul@...>
To: <IBObjects@yahoogroups.com>
Sent: Monday, June 11, 2001 12:47 PM
Subject: [IBO] Disconnect Troubles


> Hmm... let me try to rephrase it, disregarding the code sample from
before.
> I trap the error and post a message to the main form. How can I attempt
to
> reconnect. The connection status of the TIB_Connection remains as
> csConnected after the error. If I do Connect(), nothing happens because
it
> thinks it's still connected. If I do Disconnect(), I get another error
and
> the connection status remains csConnected. How can I make the
> TIB_Connection component realize that it is not connected and force it to
> try to reconnect?
>
> > -----Original Message-----
> > From: Jason Wharton [mailto:jwharton@...]
> > Sent: Monday, June 11, 2001 11:45 AM
> > To: IBObjects@yahoogroups.com
> > Subject: Re: [IBO] Disconnect Troubles
> >
> >
> > This looks to me like you could be asking for an infinit loop.
> >
> > It generally isn't a good idea to perform actually connect and
disconnect
> > operations in an error handler. it is better to set some flags
> > and then have
> > the operations be performed in some independent fashion.
> >
> > For example, you would flash a message to the user that the connection
has
> > been lost and what they should do. Then, after the exception is
> > handled they
> > would go and do whatever it was they needed to.
> >
> > HTH,
> > Jason Wharton
> > CPS - Mesa AZ
> > http://www.ibobjects.com
> >
> >
> > ----- Original Message -----
> > From: "Paul Irwin" <paul@...>
> > To: <IBObjects@yahoogroups.com>
> > Sent: Monday, June 11, 2001 11:34 AM
> > Subject: [IBO] Disconnect Troubles
> >
> >
> > > I'm trying to handle the situation where I loose a connection to the
> > > database. In the OnError event of the TIB_Connection I have
> > the following
> > > code:
> > >
> > > if (ERRCODE == 335544721 && IB_Con->ConnectionStatus !=
> > csDisconnectPending)
> > > {
> > > IB_Con->Disconnect();
> > > IB_Con->Connect();
> > > }
> > >
> > > I realize there needs to be more code to handle if it cannot connect
> > > again... but this is just some test code. The problem is that
> > Disconnect
> > > generates another error and the connectionstatus gets reset to
> > connected.
> > >
> > > How or what is the best way to handle this. I want to prompt the user
> > with
> > > a message that the connection has been lost and allow them to attempt
to
> > > reconnect.
> > >
> > > Thanks,
> > >
> > > Paul
> > >
> > >
> > >
> > >
> > >
> > > Your use of Yahoo! Groups is subject to
> > http://docs.yahoo.com/info/terms/
> > >
> > >
> >
> >
> >
> >
> > Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
> >
>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>