Hi
Just want to find out if it is possible to force the execution of the reconnect code if the msconnection comp lost the connection. This is when a automatic failover occurs. Normally it works fine and the onconnectionlost event is fired, but sometimes a error occurs, example network cable is unplugged,and the onerror event is fired. i want to know if it is possible to try re-establish the connection, from within the onerror event, using the same code that is used when the failover occurs succesfully and the onconnectionlost event is fired.
The reason is that is seems that if connection is redirected successfully all transactions are restored for the connection. If I just close and reopen the connection in the onError event, all the transactions are lost.
I just want to re try the entire reconnect process, after some additional check to ensure that failover is complete and the new principal is ready.
regards
M
Force reconnect code if connection lost
Re: Force reconnect code if connection lost
I have similar problem:
I use UniDAC with SQL Server, LocalFailover is used and OnConnectionLost is arised when
connection is lost. All is OK.
But when the computer go to in sleep mode and then is turned on,
connection is lost but OnConnectionLost is NOT arired. Instead OnConnectionLost,
OnError is arised with ErrorCode=10053. I use prNativeClient.
How can mannualy arise OnConnectionLost event from OnError event?
I use UniDAC with SQL Server, LocalFailover is used and OnConnectionLost is arised when
connection is lost. All is OK.
But when the computer go to in sleep mode and then is turned on,
connection is lost but OnConnectionLost is NOT arired. Instead OnConnectionLost,
OnError is arised with ErrorCode=10053. I use prNativeClient.
How can mannualy arise OnConnectionLost event from OnError event?
Re: Force reconnect code if connection lost
You can't initialize the OnConnectionLost event by yourself. If a critical error occurred when working with the connection, then the OnError event will occur - and all the other operations will be handled according to this event.