In disconnected mode a connection opens only when it is required. After performing all server calls connection closes automatically until next server call is required. Datasets remain opened when connection closes. Disconnected Mode may be useful for saving server resources and operating in an unstable or expensive network. Drawback of using disconnected mode is that each connection establishing requires some time for authorization. If connection is often closed and opened it can slow down application work. We recommend to use pooling to solve this problem. For additional information see TCustomDAConnection.Pooling.
To enable disconnected mode set TCustomDAConnection.Options.DisconnectedMode to True.
In disconnected mode a connection is opened for executing requests to the server (if it was not opened already) and is closed automatically if it is not required any more. If the connection was explicitly opened (the Connect method was called or the Connected property was explicitly set to True), it does not close until the Disonnect method is called or the Connected property is set to False explicitly.
The following settings are recommended to use for working in disconnected mode:
TDataSet.CachedUpdates = True TCustomDADataSet.FetchAll = True TCustomDADataSet.Options.LocalMasterDetail = True AutoCommit = True
It is recommended to use ReadCommited or ReadOnly IsolationLevel of 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.
These settings minimize the number of requests to the server.
If you perform a query with the P:Devart.IbDac.TCustomIBCDataSet.FetchAll option set to True, connection closes when all data is fetched if it is not used by someone else. If the FetchAll option is set to false, connection does not close until all data blocks are fetched.
If explicit transaction was started, connection does not close until the transaction is committed or rolled back.
If the query was prepared explicitly, connection does not close until the query is unprepared or its SQL text is changed.