Name resolution in connection string fails from ne

2019-08-27 23:47发布

问题:

I need to go sit together with the network infrastructure guys to see why suddenly SQL connection errors like below occur.

As a preparation, please provide input why this error can occur, and which things we could try at the application and/or infrastructure side to circumvent it.

  • The error occurs when starting an application from a network share.
  • The error does not occur when copying the files locally and starting it locally.
  • The error is always reproducible.
  • A couple of weeks ago (before I went on holiday) this was running fine so I am not sure when it introduced itself.

Now the complexity:

  • users are in DomainA
  • workstations are in DomainB
  • database server is in DomainB
  • database login is with user/password (no trusted connection yet)
  • logon-domain is DomainA
  • network share is in DomainA, but as part of a DFS
  • two-way trust between DomainA and DomainB
  • client applications are .NET 4 (full framework) on x86 Windows 7 Enterprise
  • server is SQL Server 2008 R2 Enterprise on x64 Windows Server 2008 R2

ConnectionString is like this:

Server=severname.DomainB\InstanceName,48000;Database=DBName;...

Tried an IP-based ConnectionString like below, and that works, so it is a name resolution thing:

Data Source=IPAddress\InstanceName,48000;Database=DBName;...

Since the IP adress might change, we'd like to keep the name (but IP address can work for a while).
What should we do to research furter into the name resolution thing?

In other words:

Why is name resolution different when starting from a network share than from a local drive? And why was it not different in the past?

Environment is pretty locked down (typical corporate environment), so simple debugging can be tough.

The IT infrastructure guys are in the midst of preparing for a split of DomainA and DomainB (one of the future actions: move a big chunk of users from DomainA to DomainB, then making DomainB the logon-domain), and try to have a minimum impact on running information.

A network-related or instance-specific error occurred while establishing a connection to SQL Server.
The server was not found or was not accessible.
Verify that the instance name is correct and that SQL Server is configured to allow remote connections.

回答1:

Use the IP address for now. If you really, really, really want a friendly name in the connection string, then use the hosts file if your network folks can't get the name resolution working. When the server moves, you can either update the config file to point to the new server (by name, if they figure out how to get it working by then, or by new IP if not), or update the hosts file to map the old friendly name to the new IP address.

We can't really tell you why it changed or why it is broken - you should get a better answer from your network team once you provide them evidence such as being able to telnet to the machine on port 48000 by IP address but not by name. They might not know the fix but that specific case is probably better asked on ServerFault.