Page 1 of 1

Proper way to handle a database connection lost

Posted: Fri 15 Mar 2013 11:43
by josecarlos
My application open the connection on the start and keeps it opened till the application, I think all desktop application working this way.

I have a customer that I am having connection issues, the application lost the database connection, and raises the message "Unable to complete network request to host "SERVER-NAME". Error writing data to the connection".

This happens when the computer client lost internet ( ADSL ) connection.

What is the best approach to handle or fix this.

I am thinking about the OnConnectionLost event and make this:

Code: Select all

procedure TdmSistema.ibDAFConnectionLost(Sender: TObject; Component: TComponent;
  ConnLostCause: TConnLostCause; var RetryMode: TRetryMode);
begin
  RetryMode := rmReconnect;
end;
Is this ok?

Thanks.

Re: Proper way to handle a database connection lost

Posted: Fri 15 Mar 2013 14:15
by AndreyZ
Yes, using the OnConnectionLost event handler is a proper way to handle connection losses. For more information, please read the "Working in an Unstable Network" article of the IBDAC documentation.

Re: Proper way to handle a database connection lost

Posted: Sat 16 Mar 2013 16:27
by josecarlos
Thanks

Re: Proper way to handle a database connection lost

Posted: Mon 18 Mar 2013 08:03
by AndreyZ
Feel free to contact us if you have any further questions about IBDAC.