Working in an Unstable Network
The following settings are recommended for working in an unstable network:
TCustomDAConnection.Options.LocalFailover = True TCustomDAConnection.Options.DisconnectedMode = True TDataSet.CachedUpdates = True TCustomDADataSet.FetchAll = True TCustomDADataSet.Options.LocalMasterDetail = True AutoCommit = True
It is recommended to use ReadCommited or ReadOnly IsolationLevel of TCustomIBCDataSet.Transaction. Use TCustomIBCDataSet.UpdateTransaction for update operations. If connection has at least one opened transaction, which is not ReadCommitedReadOnly, FailOver does not execute. All ReadCommitedReadOnly transaction are restored with FailOver operation. In Disconnected mode you can work with one ReadWrite transaction, but it is not recommended.
The following settings are recommended for working with BLOB and array fields in an unstable network.
TCustomIBCDataSet.Options.DeferredBlobRead = False; TCustomIBCDataSet.Options.DeferredArrayRead = False; TCustomIBCDataSet.Options.CacheArrays = True; TCustomIBCDataSet.Options.CacheBlobs = True; TCustomIBCDataSet.Options.StreamedBlob = False;
These settings allow to work with Blobs and Arrays without an active connection.
These settings minimize the number of requests to the server. Using TCustomDAConnection.Options.DisconnectedMode allows DataSet to work without an active connection. It minimizes server resource usage and reduces connection break probability. I. e. in this mode connection automatically closes if it is not required any more. But every explicit operation must be finished explicitly. That means each explicit connect must be followed by explicit disconnect. Read Working with Disconnected Mode topic for more information.
Setting the FetchAll property to True allows to fetch all data after cursor opening and to close connection. If you are using master/detail relationship, we recommend to set the LocalMasterDetail option to True.
It is not recommended to prepare queries explicitly. Use the CachedUpdates mode for DataSet data editing. Use the TCustomDADataSet.Options.UpdateBatchSize property to reduce the number of requests to the server.
If a connection breaks, a fatal error occurs, and the OnConnectionLost event will be raised if the following conditions are fulfilled:
If the user does not refuse suggested RetryMode parameter value (or does not use the OnConnectionLost event handler), IBDAC can implicitly perform the following operations:
Connect; DataSet.ApplyUpdates; DataSet.Open;
I.e. when the connection breaks, implicit reconnect is performed and the corresponding operation is reexecuted. We recommend to wrap other operations in transactions and fulfill their reexecuting yourself.
The using of Pooling in Disconnected Mode allows to speed up most of the operations because of connecting duration reducing.