Topics from the Microsoft SQL Server Protocols team - Netlibs, TDS, SQL Browser, etc.
Users often see this error message when connection to a SQL Server and don't know where to start to solve the problem. In most forums, people says this is because remote connection is not enabled on the server. This is not exactly correct. Actually, this error message give customers 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 default instance, you never see this. Why? Because even if we failed at this stage (i.e. error locating server/instance specified), we will continue to try connect using default values, e.g defaul TCP port 1433, default pipe name for Named Pipes. You may see other error message 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 these information, client does know how to connect the server and it fails with this specified error message. In a word, 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 isolate the issue. Here are the steps:1) Make sure your server name is correct, e.g., no typo on the name. 2) Make sure your instance name is correct and there is actually such an instance on your target machine. [Update: Some application converts \\ to \. If you are not sure about your application, please try both Server\Instance and Server\\Instance in your connection string]3) Make sure the server machine is reachable, e.g, DNS can be resolve correctly, you are able to ping the server (not always true). 4) Make sure SQL Browser service is running on the server.5) If firewall is enabled on the server, you need to put sqlbrowser.exe and/or UDP port 1434 into exception.
Once you are done the steps, you should not see this error message anymore. You may still fail to connect your SQL server, but error message should be different and you have a different issue now. [Update: If it still fails, you may replace server\instance with tcp:server\instance and/or np:server\instance and see if it succeeds with either TCP or NP protocol. That way, you can isolate the issue a little bit. ]
There is one corner case where you may still fail after you checked step 1)-4). It happens when a) your server is a named instance on cluster or on a multi-homed machine, and b) your client is a Vista machine with Firewall on. I have explained the details at: Unable to connect to a SQL Server named instance on a cluster
[Update May 2009] My collegue found a good tool online which could be very helpful for users to isolate issues related to this error message. You can download PortQry from http://support.microsoft.com/kb/832919, run "portqry.exe -n yourservername -p UDP -e 1434". If this command returns information and it contains your target instance, then you can rule out possiblity 4) and 5) above, meaning you do have a SQL Browser running and your firewall does not block SQL Browser UDP packet. In this case, you can check other issue, e.g. wrong connection string.
As a final note, the error message for the same issue when you use SNAC is: [SQL Native Client]SQL Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF].
If you still see this error, please post questions at MSDN SQL Server Data Access Forum:http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=87&SiteID=1 Please mention you already read this post and confirm steps you have taken and the results of each step.(e.g. server\instance,etc)
Xinwei Hong, SQL Server ProtocolsDisclaimer: This posting is provided "AS IS" with no warranties, and confers no rights
I searched many places and everybody writes about remote connection is not enabled on the server.
I had that on but still it wasn't working. I was trying to connect to a SQL Server named instance. I had TCP port 1433 in exception but still didn't work.
Finally after I saw your post and especially step 4 where you mention to put UDP post 1434 in exception, everything is working now. That was very helpful.
Thank you so much. I spent hours trying to figure this out and am glad I found this blog entry. For me I was unable to use the UNC to resolve the IP so instead used the IP Address and was able to connect from SQL Server Mgmt Studio.
I made everthing.. what did U write..
my situation is:
SQL server 2005 TRIAL worked fine for 6-7 hours.. and then it stops accepting TCP/IP clients.. :S
where is the problem.. I added sqlbrowser.exe to firewall, UDP port 1434, and still nothing
Do you still see "error: 26" after you did everything? This is not supposed to fix all connection issues.
yes.. that error..
i dont understand.. server works fine.. and just stop accepting users from TCP/IP..
if I connect local(any protocol) it works.. just remote ppl cant access 2 MSSQL
Can you tell me your connection string? Are you sure SQL Browser is running? What's the output if you run "sc query sqlbrowser" on server?
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
C:\Program Files\Microsoft SQL Server\90\NotificationServices\9.0.242\Bin>sc query sqlbrowser
TYPE : 10 WIN32_OWN_PROCESS
STATE : 4 RUNNING
(STOPPABLE, PAUSABLE, ACCEPTS_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
Sorry, can you please tell me your connection string? Or at least, the server and instance name?
i usualy connect with SQL native client (Data sources [ODBC])
server 18.104.22.168\SQLEXPRESS (before it was SQL 2005 TRIAL )
username - test
passwd - test321
and sql server browser service is logined as local system.. and he is running
tcp/ip, pipes, shared memory are enabled, tcp/ip port - 1433
and error when i'm connecting :
Do you have a sqlexpress installed on that machine? Is it actually a default instance as you mentioned port 1433? Does that machine have multiple IP addresses? Did you check the link I mentioned in the post for exception?
i fixed sql server..
I connect direct to instance with port..
i'm not using sql browser..
and it works fine..
Is there a way to do this programatically in C# (VS2005) in my application so that my installation is not thwarted by this and I don't have to walk my customers through this?
Also, a related connection question: My earlier downloads of SqlExpress named the instance of SqlServer 'SQLEXPRESS'. A customer downloaded the newest version from the MS website and his instance is named 'MSSQLSERVER'. My DB connection string is "Data Source=.\\SQLEXPRESS;Integrated Security=True;Connect Timeout=200;User Instance=True;database = LOCAL_RXDB", so does this mean that this string will never work with an instance named 'MSSQLSERVER'? Can I rename an instance on a machine? Why does the SqlExpress download instance no longer install as 'SQLEXPRESS'? Thank you so very much for any information you can give me.
If your configuration is corret, you won't see this error (except for the special case). So, no need to do it programatically.
By default, sqlexpress will install a SQL instance with "sqlexpress" as the instance name, however, you can specify other instance name or default instance when you install. You cannot change the instance name once you installed. Why don't you fix your connection string by using "Data Source=."? If it's due to the visual studio bug, (see here http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1678480&SiteID=1), use the following workaround:
From Visual Studio, --> Tools menu --> Options --> Database Tools --> Data Connections -->
Change your "SQL Server Instance Name" from "sqlexpress" to blank.
Hope this help.