Subject | Re: [IBO] TIB_Connection Losing Connection. PLEASE HELP |
---|---|
Author | Infocare Developer |
Post date | 2002-10-30T09:45:02Z |
ok i have narrowed it down a bit, this is what i have discovered,
I have simulated the problem by starting the server and then killing the
connections from another app.
VerifiyConnection tells me if the connection is ok,
when this is false i can set Connected to false and connected to True, so
the reconnect works fine,
But as soon as I run any queries against the server I see that there are
some transactions linked to the TIB_Connection, and after that It cannot
reconnect any more the exception is "Error writing to the connection"
Now i assume i have to somehow cancel all the transactions before trying the
reconnect, I have tried
ForceDisconnect - This still raises the exception and does not disconnect
I have tried CloseTransactions before calling forcedisconnect, still no luck
So how can i simply cancel the transactions linked to it without the
component trying to "write to the connection" upon reconnect?
All our query components start transactions as follows:
if not qryXX.IB_Transaction.InTransaction then
qryXX.IB_Transaction.StartTransaction;
if not qryXX.IB_Transaction.Started then
qryXX.IB_Transaction.Started := true;
try
try
qryXX.Open;
finally
qryXX.IB_Transaction.Commit;
end;
except
try
qryXX.IB_Transaction.Rollback;
except
end;
raise;
end;
Any help is higly appreciated
I have simulated the problem by starting the server and then killing the
connections from another app.
VerifiyConnection tells me if the connection is ok,
when this is false i can set Connected to false and connected to True, so
the reconnect works fine,
But as soon as I run any queries against the server I see that there are
some transactions linked to the TIB_Connection, and after that It cannot
reconnect any more the exception is "Error writing to the connection"
Now i assume i have to somehow cancel all the transactions before trying the
reconnect, I have tried
ForceDisconnect - This still raises the exception and does not disconnect
I have tried CloseTransactions before calling forcedisconnect, still no luck
So how can i simply cancel the transactions linked to it without the
component trying to "write to the connection" upon reconnect?
All our query components start transactions as follows:
if not qryXX.IB_Transaction.InTransaction then
qryXX.IB_Transaction.StartTransaction;
if not qryXX.IB_Transaction.Started then
qryXX.IB_Transaction.Started := true;
try
try
qryXX.Open;
finally
qryXX.IB_Transaction.Commit;
end;
except
try
qryXX.IB_Transaction.Rollback;
except
end;
raise;
end;
Any help is higly appreciated
----- Original Message -----
From: "Helen Borrie" <helebor@...>
To: <IBObjects@yahoogroups.com>
Sent: Wednesday, October 30, 2002 10:19 AM
Subject: Re: [IBO] TIB_Connection Losing Connection. PLEASE HELP
> At 10:12 AM 30-10-02 +0200, you wrote:
> >We have an Asta Server, this server sets up X amount of sessions to the
> >Database, lets say 10 for example.
> >
> >For some misterious reason interbase/firebird will sometimes disconnect
due
> >to some kind of network problem and IBO will lose it's connection to the
> >database. Now after this has happened the TIB_Connection keeps raising
the
> >same connection i don't have the exact text but i am sure everyone here
is
> >fermiliar with the kind of exception, something like "the connection was
> >forcibly closed" or something else,
>
> TIB_Connection is actually delivering an error from the API, which is
> raised when your application passes a request that can't be carried
through
> because the gds client program finds it cannot communicate with the
server.
>
>
> >The problem is that Even if I capture this exception i cannot reconnect
the
> >TIB_Connection, the TIB_Connection's connected property stays true even
> >though it's not!!
>
> TIB_Connection is the encapsulation of a set of API calls. Its Connected
> property stays true until your application sets it false. The GDS library
> doesn't somehow jump inside your software and switch off the light!
>
> >The only way to see is to call something like
> >TIB_Connection.VerifyConnection.
>
> Correct. This is the closest that IB_Connection can get to "the wire".
It
> can't detect anything other than "My Connected flag is true but I'm not
> connected to anything". That will then set the ConnectionWasLost flag and
> should then invalidate its Connected setting.
>
>
> >Now that raises an Exception, I catch the Exception and then try to
> >explicitly call TIB_Connection.Connected := False;
> >and then TIB_Connection.Connected := True;
> >(Effectively a Reconnect)
>
> You won't be able to set Connected := True unless a successful connection
> is made. Use Connect to attempt to reconnect. If it succeeds, you're in
> business. If it fails, you know that the network fault is still there.
>
>
> >But then another exception is raised because it is not connected to the
DB,
> >you can't even free the object cause it raises an exception again.
> >
> >Why does the component not handle this automatically?
> >why can it not automatically verify it's connection and try to
reestablish?
>
> How can it know what went wrong on the network? Even the GDS client
> doesn't have enough information to determine the kind of network fault
that
> occurred nor the ability to fix network faults. IBO is an interface
> between your program and the GDS client :: the GDS client is the interface
> to the server on a functioning network connection.
>
> >Because when this happens, all the clients must disconnect and the server
> >must be restarted,
>
> It sounds as if you have some work ahead of you to discover why the
network
> is dropping connections. This is Pandora's box.
>
> >PLEASE HELP
>
> Try raising a question in ib-support or the ASTA forums. When you do,
> describe your network setup! For example, if you are using a Win2k Pro,
XP
> Pro or NT Workstation server, along with NetBEUI for your user
connections,
> then 10 is the magic number of connections beyond which your network will
> turn every flavour of custard.
>
> Helen
>
>
>
>
___________________________________________________________________________
> 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 !
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>