Local Failover, UNITable, Firebird

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
michaschumann
Posts: 44
Joined: Fri 14 Nov 2014 15:26

Local Failover, UNITable, Firebird

Post by michaschumann » Fri 14 Nov 2014 17:27

Hello,

I have a connection to Firebird and a table with some fields attached via datasource. If I provoke a problem by stopping the firebird service the connection is restored but the ttable fields are cleared and the user would loose all data on saving. Is there a setting at the components I am missing?

Thanks in advance!

Michael

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Local Failover, UNITable, Firebird

Post by ViktorV » Mon 17 Nov 2014 08:46

To resume lost connection, you should use the TUniConnection.OnConnectionLost event handler. The OnConnectionLost event handler is used to process fatal errors and perform failover. To make the OnConnectionLost event handler work, you should set the TUniConnection.Options.LocalFailover property to True. Note that to use the OnConnectionLost event handler, you should add the MemData unit to the USES clause of your unit. Here is an example of using the OnConnectionLost event handler:

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
begin
  UniConnection1.Options.LocalFailover := True;
  UniConnection1.Open;
end;

procedure TForm1.UniConnection1ConnectionLost(Sender: TObject;
  Component: TComponent; ConnLostCause: TConnLostCause;
  var RetryMode: TRetryMode);
begin
  RetryMode := rmReconnectExecute;
end;
In this case, if connection was lost, UniDAC will try to reconnect and reexecute the abortive operation. For more information, please read the UniDAC documentation.

Post Reply