FireDAC.Comp.Client.TFDCustomConnection.OnRecover
Delphi
property OnRecover: TFDConnectionRecoverEvent read FOnRecover write FOnRecover;
C++
__property TFDConnectionRecoverEvent OnRecover = {read=FOnRecover, write=FOnRecover};
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
event | public | FireDAC.Comp.Client.pas FireDAC.Comp.Client.hpp |
FireDAC.Comp.Client | TFDCustomConnection |
Description
Occurs when the connection to the DBMS is lost.
The event handler of OnRecover receives the following parameters:
ASender
is the connection.AInitiator
is the object that discovers that the connection has been lost.AException
is the exception that describes the issue that occurred.AAction
determines the action that FireDAC must take to handle this issue.
You can handle OnRecover to analyze the cause of the issue and determine how FireDAC must handle the issue. To determine how FireDAC must handle the issue, change the value of AAction
to any of the following values:
Action | Description |
---|---|
|
If ResourceOptions.AutoReconnect is |
|
Close the connection and raise |
|
Try to reconnect. |
|
Close the connection and abort the current operation. |
|
Switch the connection to the offline mode and abort the current operation. |
To have FireDAC retry the connection, do either of the following:
- You change the value of
AAction
tofaRetry
. - You leave the value of
AAction
asfaDefault
and ResourceOptions.AutoReconnect isTrue
.
If you have FireDAC retry the connection, FireDAC retries the connection up to 3 times. After 3 failed connection attempts, FireDAC closes the connection and raises AException
.