FireDAC.Comp.Client.TFDCustomConnection.OnRecover

From Appmethod Libraries
Jump to: navigation, search

Object Pascal

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

faDefault
(default)

If ResourceOptions.AutoReconnect is True, try to reconnect.
If ResourceOptions.AutoReconnect is False (default), close the connection and raise <AException>.

faFail

Close the connection and raise <AException>.

faRetry

Try to reconnect.

faCloseAbort

Close the connection and abort the current operation.

faOfflineAbort

Switch the connection to the offline mode and abort the current operation.

To have FireDAC retry the connection, do either of the following:

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>.

See Also