Subject Re: [IBO] TIB_Connection Losing Connection. PLEASE HELP
Author Helen Borrie
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