Page 1 of 1

Local Failover, UNITable, Firebird

Posted: Fri 14 Nov 2014 17:27
by michaschumann
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

Re: Local Failover, UNITable, Firebird

Posted: Mon 17 Nov 2014 08:46
by ViktorV
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.