Hi All,
Let me lay out the scenario we're facing and get your input.
We're currently on SDAC 4.x, working with a very large application. In our application we use a single MSConnection, and thousands of query objects throughout the application. Some at design-time, many at run-time. Some running for only a moment, others open for the entire time the application is open. So with that there are MANY DataSets that are open practically from initialization all the way through to finalization.
Between all of the various places we use SDAC in the application, the is no consistent usage of FetchAll, CachedUpdates, etc. There is a mixture of ad hoc queries (ExecSQL), Tables, Queries, Stored Procs... You name, we're probably using it.
In one of the more recent help files, there is a document titled "Working in an Unstable Network." where you outline some ways to handle unstable connections and unexpected disconnects.
Is there any practical way to achieve a graceful/seemless reconnect using the 4.x series of SDAC components?
If not with 4.x, will upgrading to the latest 6.x SDAC suite, given the application design I mentioned above, allow us to more gracefully/seamlessly handle unanticipated disconnects?
Thank you in advance for your input.
Unstable network environments
Hello,
To resume lost connection, you should use the TMSConnection.OnConnectionLost event handler. The OnConnectionLost event handler is used to process fatal errors and perform failover. To make the OnConnectionLost event handler work, you should set the TMSConnection.Options.LocalFailover property to True. Note that to use the OnConnectionLost event handler, you should add the MemData unit to the USES clause of your unit. Here is an example of using the OnConnectionLost event handler:In this case, if the connection was lost, SDAC will try to reconnect and re-execute the abortive operation. The "Working in an Unstable Network" article of the SDAC documentation describes SDAC options that allow working with an unstable network. This article is included in all SDAC 4.x versions, so you can use all the ways described in it using SDAC 4.x .
To resume lost connection, you should use the TMSConnection.OnConnectionLost event handler. The OnConnectionLost event handler is used to process fatal errors and perform failover. To make the OnConnectionLost event handler work, you should set the TMSConnection.Options.LocalFailover property to True. Note that to use the OnConnectionLost event handler, you should add the MemData unit to the USES clause of your unit. Here is an example of using the OnConnectionLost event handler:
Code: Select all
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
MSConnection1.Options.LocalFailover := True;
MSConnection1.Open;
end;
procedure TForm1.MSConnection1ConnectionLost(Sender: TObject;
Component: TComponent; ConnLostCause: TConnLostCause;
var RetryMode: TRetryMode);
begin
RetryMode := rmReconnectExecute;
end;