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
thanks for this great information. this really eased my preasure
If you have gone through all those five steps,,and still it is showing the error 26 then please do some change in SQL server configuration tool.
All Programs->Microsoft SQL Server 2008->Configuration tools->SQL Server configuration manager->Aliases
Put some aliase (name) for your server.
And then try to access the server with that name.
All Programs->Microsoft SQL Server 2008-> SQL server Management studio
use your aliase as your server name
Hope this will work..
Thanks a lot. By enabling the SQL Browser service. I was able to connect to one of SQL Server instance.
I have been trying to connect to PCNAME\SQLEXPRESS using Microsoft SQL Server Management Studio. This is on a LAN connected to the internet via a LinkSys router. A can connect to SQLserver on one machine but not another.
I discovered that if I ping the PCNAME that works it resolves to a local IP address (192.168.1.105) but the one that doesn't work resolves to an external IP address and reports the name as:
This is obviously the root cause of my problem - if I disconnect the modem ping resolves locally and SQLserver works on both machines.
Can anyone tell me why the name pings to an external IP address and how to prevent it?
My problem was my ISP, Virgin Media. They intercept unknown addresses and take you to their "Advanced Error Search" page (i.e. an excuse for throwing advertising at you). I turned it off and can now connect to SQLEXPRESS across my LAN.
Two days wasted effort. Thanks Virgin.
First of all thanks for this great information. I have the same problem here. I wish someone can help.
Everything works fine on my computer. I have win7 and use Visual studio 2008.
After I upload my website on the hosting and spending sometime to be able to set the connectionstrings right, I have another problem.
I use the ASP.NET C# database (Which I can create users, login, set membership, rols and....). I have added two more tables for some additional information (Like images and other data).
Here is my confusion --> I can add data to those two tables and see the data from them through my website (I think this means connection is correct and it is working) , good up to here.
Then when I want to try Login or Create user --> Error 26 :(
I checked and saw 1433 and 1434 are Filtered by my hosting company. My question is do I still need these ports open?! I can see my other tables!!! And most important thing is how can I fix this?
Specifically on my case to resolve error: -26.
All i did was change from "ServerName/Instance" to "IP/Instance" and connection worked like a charm!
hi. I'm dealing with this error. My situation is I don't have an instance name. I'm using VS2010 and MSSql 2008 with a default instalation and no instance name.
My connstring is like follow:
Integrated Security=SSPI;Persist Security Info=True;Initial Catalog=MyDB;Data Source=MyDBServerName
I am having the problem
Exception Details: System.Data.SqlClient.SqlException: 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. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)"
The thing is that when I run my website in localhost the database works perfect but when I launch it on the hosting company it does not work.
The hosting company sent me this code
dbconn=New SqlConnection("Data Source=mssql.namesco.net;Database=dbname;User
to use in order to establish connection with MSSQL server but still I have the same error.
Can you please help me what is the problem and give me any tips when website with SQL server is launch in internet online?
Thanks in advanced !
I am not sure if this a VirtualBox question or not...
I have a new Windows 7 host with my old OS (XP SP3) set up on VirtualBox. I am getting this #26 error as specified above. I can connect ping the VM and browse to its shares. I am using SSMS08R2 client to connect and get the above message.
The guest VM is running XP SP3 with SS2K MSDE SP4 installed on it. I can osql to it from inside the VM and connect with EM and QA. All good. SQL Browser is running and set to Automatic. Remote connections are allowed in sp_configure.
I have tried PortQry.exe (seems to run ok on 64-bit Windows 7) and it reports correctly for an SS08R2 instance out on the network (which also happens to be on a VM (VMWare)) but it failes to resolve the IP address when I query my SS2K instance on my VM.
I have tried all variations of IP_Address\Instance_Name and tcp:IP_Address\Instance_Name,1433, etc, etc. Nothing works.
Has anyone any idea?
Installed SQL Express 2008 everything worked fine on the corporate LAN. Moved off to isolated network and now the client is unable to access (Error Locating Server/Instance); I have performed all of the recommended checks 1-5, firewall off. Added local hosts file to ensure server is pingable and changed IP address to the new isolated server IP for the named instance in SQL configuration manager. I am able to test the data source locally on the server and successfully test the database connection is good.
Any one know why one of client cannot connect to server ??
I have 1 server 2 client
All computer are window xp sp 2
server are SQL SERVER 2005
SQL Network Interfaces 26 .....
When i run my program ... 1 of client can't connect to server , firewall already off ..... the others like ping to computer and shared folder are OK...
it gives what is required in decent way respecting users time.
Thanks a lot
I have 2 clients. One client will connect with the instance, the other (new) will not, and I need to use the port number. Any Ideas?
I would check to ensure the firewall is not block the db port and the server name is use in the connectionstring. connectionstringexamples.com/.../network-interfaces-error-locating-server-instance-specified