Hi
I'm currently running SQL 2005 Mirroring setup. Using a simple app that just connect to the current principal database of the mirroring pair.
MSConnection is setup with the connection string pointing to the principal server.
On the TMSConnection object the Failoverpartner and localfailover values is specified. All that the app does is it loads all the record from a single table in the database to a grid, using a query component and the msconnection.
Using SDAC 4 with Delphi 5.
App is running on PC1 that link to the principal DB on PC2 with the mirror on PC3.
When using the failover option in SQL to force failover of the databses, the msconnection work 100%. the OnLostConnection event is raised and the connection is reconnected to the failOver server. If the failover is done back again everything still works. No problems there.
The problem occurs when the network cable is unplugged. The failover takes a couple of second longer(10seconds), where if the failover function in sql is used, the failover takes 1 or 2 seconds.
If I refresh the grid data as soon as I unplug the cable, there is a delay, connection time out period, and then I get the error 'TCP Provider: The semaphore timeout period has expired'. If I try the refresh the dataset again the I get the error 'Communication link failure. From then on it stays with the communication error. Not once did the OnLostconnection event fired to try and reconnect to the failOver server.
It seems that msconnection detects the network error, to the principal server, first and stops at that point and does not try to connect to the failover server. I can add code in the onerror event of msconnection to close and reconnect the connection, but is there a way to force msconnection to try a reconnect to the failover server when the communication link error occurs. The network link to the failover server is still up and running, it is only the principal server network link that died.
Regards
Magnus
Failover fails when network cable unplugged.
-
- Posts: 3
- Joined: Tue 13 Apr 2010 06:26
-
- Posts: 3
- Joined: Tue 13 Apr 2010 06:26
-
- Posts: 21
- Joined: Fri 09 Nov 2007 23:29
Re: Failover fails when network cable unplugged.
I know this is an old thread but I've similar problem with one of my service applications.
Service app connected to database server (on different server) and if some communication problem has happened between database server and service server I got "Communication link failure". And the service application is giving error to all clients if I didn't restart it.
As you wrote it's related to native client, also as some MSFT wrote detailed cause of this problem here: http://social.msdn.microsoft.com/Forums ... baseengine
So what I wanna ask is simply disconnecting the TMSConnection can solve the problem?
If I wrote TMSConnection.Disconnect; inside OnError event, can this solve my problem. Also how can I learn the exact error code of "Communication link failure" error to write TMSConnection.Disconnect; code for specific error code.
Thanks...
Service app connected to database server (on different server) and if some communication problem has happened between database server and service server I got "Communication link failure". And the service application is giving error to all clients if I didn't restart it.
As you wrote it's related to native client, also as some MSFT wrote detailed cause of this problem here: http://social.msdn.microsoft.com/Forums ... baseengine
So what I wanna ask is simply disconnecting the TMSConnection can solve the problem?
If I wrote TMSConnection.Disconnect; inside OnError event, can this solve my problem. Also how can I learn the exact error code of "Communication link failure" error to write TMSConnection.Disconnect; code for specific error code.
Thanks...
Re: Failover fails when network cable unplugged.
To retrieve the error code in the onError method you can use the E: EDAError: E.ErrorCode parameter and run the Disconnect method on an a particular error occurrence.