I am using lacal failover with a database in disconnected mode, everything is autocommit and the datasets have the autoclose property and always fetchall.
The Database Connection sets:
On Error: Fail := false;
OnConnectionLost: RetryMode := rmReconnectExecute;
I simulate lost connction by stopping the firebird instance. I have two issues:
1. Even when I do nothing with the attached loaded datasets, after some time the reconnect event occures. Why? I assumed that in disconnected mode even updating is buffered with cachedUpdates.
2. If the connection is lost the application is completely frozen and "thaws" when the connection can be restored. Is it possible to have the UI responsive during that time?
Local Failover
Re: Local Failover
1. Reconnection to the server occurs only on calling it. IBDAC itself doesn't initialize attempts to call the server. Therefore, please compose a small sample reproducing the issue and send it to viktorv*devart*com - and we will tell you the reason for such behavior.
2. Application hanging occurs on an attempt to connect to the database. Therefore, to avoid program hanging, you can try to reconnect several times and stop attempts if reconnection fails. For example, you can use the following code:
In this case, IBDAC will attempt to restore connection twice and generate an exception in case of failure.
2. Application hanging occurs on an attempt to connect to the database. Therefore, to avoid program hanging, you can try to reconnect several times and stop attempts if reconnection fails. For example, you can use the following code:
Code: Select all
var
RetryCount: Integer;
procedure TMainForm.IBCConnection1ConnectionLost(Sender: TObject;
Component: TComponent; ConnLostCause: TConnLostCause;
var RetryMode: TRetryMode);
begin
if RetryCount < 2 then begin
Inc(RetryCount);
RetryMode := rmReconnectExecute;
end
else begin
RetryCount := 0;
RetryMode := rmRaise;
end;
end;