Sometimes you may see “SQL Network Interfaces, error: 26 – Error Locating Server/Instance Specified” error message when connecting to a SQL Server and don’t know where to start. In most forums people say this is because remote connection is not enabled on the server. This is not exactly correct. Actually, this error message gives customers a very specific information and the solution is quite simple.
First of all, you get this error message only if you are trying to connect to a SQL Server named instance. For a default instance you never see this. Why? Because even if we have failed at this stage (i.e. error locating server/instance specified), we will continue to try connect using default values, e.g default TCP port 1433, default pipe name for Named Pipes. You may see others error messages due to failure later, but not this error message.
Every time client makes a connection to SQL Server named instance, we will send a SSRP UDP packet to the server machine UDP port 1434. We need this step to know configuration information of the SQL instance, e.g., protocols enabled, TCP port, pipe name etc. Without this information, a client does know how to connect to the server and it fails with this specific error message.
In other wors, the reason that we get this error message is the client stack could not receive SSRP response UDP packet from SQL Browser. It’s easy to resolve the issue. Here are the steps:
- Make sure your server name is correct, e.g., no typo on the name.
- Make sure your instance name is correct and there is actually such an instance on your target machine. (Try to use a connection string like .<instance-name> to connect to an instance on your local computer. E.g: .SQLEXPRESS)
- When you try to connect to an SQL Server instance on another server, make sure the server machine is reachable, e.g, DNS can be resolve correctly, you are able to ping the server (not always true).
- Make sure SQL Browser service is running on the server.
- If firewall is enabled on the server, you need to put sqlbrowser.exe and/or UDP port 1434 into exception.
Once you are done with these steps, you should not see this error message anymore.