We have a native Visual C++ application compiled with VS 2005 that when it starts establishes a connection to a local (on the same computer) sql server 2005 express database through ADO with OLEDB provider for sql server, and keeps the connection opened during all its life. The computer could have any network connection for example a local network hence have a network adapter or an ADSL modem. When the application starts with the network connection active, any operation on the sql server connection fail after whether the network connection has been closed, for example disabling the network adapter or the ADSL modem.
The first error I get is:
description literally translate from italian "generic network error" in english may be "Communication Link Failure"
SQL State: 08501
Native Error: 11
That doesn't happen whether the application start while the network connection is not active that is whether the sql server connection is established while the network connection is not active.
That is whether network connection is not active I start my application and then enable and disable the network connection over and over and the application always works fine.
I have noticed that when the sql server connection is opened while the netwok connection is closed the columns values of client_net_address and local_net_address in the sys.dm_exec_connections table are the localhost ip address 127.0.0.1 whereas if the sql server connection is opened while the netwok connection is opened that values are equal to the network adapter ones (ex 10.0.0.106).
In the string connection we use "local" or "computer name" for server value.
May be I have to use "localhost" instead of "local" in the sql connection string?