SQL Network Interfaces, error: 26 – Error Locating Server/Instance Specified


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 ServerInstance 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 serverinstance with tcp:serverinstance and/or np:serverinstance 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. serverinstance,etc)  

 

Xinwei Hong, SQL Server Protocols
Disclaimer: This posting is provided “AS IS” with no warranties, and confers no rights


Comments (286)

  1. Rabi says:

    great post.

    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.

  2. AGeorge says:

    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.

  3. pRoFiOn says:

    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  

  4. Xinwei Hong says:

    Do you still see "error: 26" after you did everything? This is not supposed to fix all connection issues.

  5. pRoFiOn says:

    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

  6. Xinwei Hong says:

    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?

  7. Manju says:

    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)

  8. profion says:

    C:Program FilesMicrosoft SQL Server90NotificationServices9.0.242Bin>sc query sqlbrowser

    SERVICE_NAME: 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

  9. Xinwei Hong says:

    Sorry, can you please tell me your connection string? Or at least, the server and instance name?

  10. pRoFiOn says:

    i usualy connect with SQL native client (Data sources [ODBC])

    server 193.198.63.16SQLEXPRESS (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 :

    http://img186.imageshack.us/my.php?image=hmmmci7.jpg

  11. Xinwei Hong says:

    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?

    http://blogs.msdn.com/sql_protocols/archive/2006/02/27/unable-to-connect-to-a-sql-server-named-instance-on-a-cluster.aspx

  12. pRoFiOn says:

    i fixed sql server..

    I connect direct to instance with port..

    i’m not using sql browser..

    and it works fine..

    thx πŸ™‚

  13. sjspain says:

    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?

  14. sjspain says:

    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.

  15. Xinwei Hong says:

    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.  

  16. sjspain says:

    For reasons I do not understand, the connection fails with either "Data Source=.\ etc" or "Data Source=. etc." , whether I have SQLEXPRESS running and MSSQLSERVER stopped or vice versa or both running on my dev machine.  My customer installed SqlExpress from the MS page, and it gave him an instance named ‘MSSSQLSERVER’.  Has the instance name of the SqlServer download been changed to MSSQLSERVER?  This does not seem logical, but appears to be the case.

  17. rstreeter says:

    I was getting this same error, and I am still unfamiliar with many aspects of SQL 2005. After verifying the steps above, I was about to give up and try rebooting. Then I thought to simply restart the SQL Browser service and it worked.

    Thanks for leading me down the right path.

  18. Kevin Matzen says:

    I am receiving this error after I have published my ASP.NET application from Visual Studio.  When running the site through Visual Studio, everything works perfectly fine.  However, after I publish it to IIS, anytime my code accesses the database, I receive error 26.  The sql server is located on the same computer as IIS.  TCP/IP, named pipes, and shared memory are enabled and VIA is disabled.  Server browser is running.  I have also tried the connection string with the ip address.  All options work fine in VS, but not in IIS.

    Previously I had been receiving error 40, but then I reinstalled sql server and it is now error 26.

  19. Kevin Matzen says:

    Sorry to bother anyone with my previous problem.  ‘Tis solved.  I just reinstalled IIS, but also deleted the inetpub directory so that the permissions would be set upon installation.  Then I received better error messages that allowed me to configure my database’s permissions.

  20. Atif says:

    <add key="strCommonDB" value="server=OASISMSQLEXPRESS_05;database=CommonDB;uid=ohm;password=ohm"/>

    Above is my connection string.

    I have made all changes taht u specified. But getting still same error.

    I am using SQLExpress addition with windows XP

  21. Xinwei Hong says:

    What application is this? Sometimes, application needs "\" to replace "". Can you try …server=OASISM\SQLEXPRESS_05….?

  22. Atif says:

    Hi,

    I have been stuck up with this error.

    I am using SQL Srver express edition with asp.net 2.0 on windows XP SP2.

    When I open the SQL Management studio and execute queries it works fine.

    When I exute query in command prompt using SQLCMD -E -S ServernameInstance

    It conect with database and I can freely execute queries in command prompt.

    I have also tried to connect with Classical ASP 3.0 It also works fine. No error

    I have made all changes that u specified in ur article.

    But When I try to connect with asp.net. It gives me error.

    "provider: SQL Network Interfaces, error: 26 – Error Locating Server/Instance Specified)"

    Connection string

    <add key="strCommonDB" value="server=OASISMSQLEXPRESS_05;database=CommonDB;uid=ohm;password=ohm"/>

    I have also tried this

    <add key="strCommonDB" value="server=OASISM\SQLEXPRESS_05;database=CommonDB;uid=ohm;password=ohm"/>

  23. Atif says:

    Same files are  working fine in my office with SQL Server 2005 enterprise edition and ASp.net 2.0.  on Windows server 2003. I do not get this error. But at home I am facing this problem again and again.

  24. Claudia says:

    Thank you so much, you’ve no idea how many hours i spent trying to fix this. I visit alot of Forums and tutorial, and nothing.

    But with you it really work. Thanks again you save my day.

  25. Karthik says:

    None of the above solved the problem for us. We are able to connect from same subnet; but not from other subnets. What could be the problem?

  26. Ekennedy says:

    I just migrated my development environment from Windows XP to Vista.  I read your post, but I’m still having trouble figuring our what I need to do.  My data connection is an existing "mdf" file on my local machine. Even though the file is local, do I need to somehow change the connection string to include a port number?  If so, can you point me to an example of how to do that?  Thank you.

  27. Raf says:

                    How do connect a sql server in a network.when i am connecting the server to client i am facing the network problem.The client is not accept the server.How can i Solve the problem?

  28. Rodio says:

    I’m trying to connect using the Asp.Net web site administration tool. I can see the database in the Visual Web developer 2005, but still unable to connect through the administration tool? Any solutions?

  29. I am having the same error:26 problem.  My connection string is –

           <add name="teddbConnectionString2" connectionString="Data Source=.SQLEXPRESS;AttachDbFilename=&quot;|DataDirectory|teddb.mdf&quot;;Integrated Security=True;Connect Timeout=30;User Instance=True"            providerName="System.Data.SqlClient" />

    The syntax of this string was recommended by an Expression Web tutorial.   The database works fine locally.  The only difference is that locally, I use the full dataset name instead of the |DataDirectory| – When I upload to my ISP I get the error.  Can you point me in the right direction?

    Thanks.

  30. pv says:

    If you have ‘sql network interfaces error 26’ -‘ remote connection not possible…etc’ and trying to attach SQL Express 2005, pls. try restarting the SQL Express 2005 from SQL Configuration Manager.

    If you are using the Database in the SQL Server Management Studio and trying to connect with your code or from Visual studio, you get an error ‘Another process is using’ – Restarting the service helps.

  31. Duva says:

    Yeah…This was really helpful for me.  Especially the point number 4 resolved the issue.  

    Thanks a lot

  32. Elaine Mayer says:

    I just want to share some info with you all. I have one user got the same error when connect to the named instance and our solution is to use the right TCP/IP port. Our named instance use a different port other than 1433. Once direct use to connect through the right port, everything works fine.

    elaine

  33. Matt says:

    Great article solved my problem instantly.

    Thanks.

  34. TuAnh says:

    I installs SQL server 2005 express on two computer in LAN. In one I used Microsoft SQL Server Management Studio Express remote connect to that, It’s ok. But when i used connect string in C# to remote connect, It’s error. Please help me.

    Note:

    conStr = "server=computer2\SQLEXPRESS;database=dataname;pwd=password; uid=username; Trusted_Connection=false;Integrated Security=SSPI"

  35. nicky says:

    This is the way how I encounter the error 26.

    I’ve everything works fine on my XP running with SQL Express. However, when I change the file system from FAT32 to NTFS, I encounter the error 26. The only way I can solve the problem is to goto the [MyComputer] >> [Manage] >> [Computer Management] >> [Services & Applications] >> [SQL Server Configuration Manager] >> [SQL Server 2005 Services]

    there I change the built-in account from "Network Service" to "Local System". Then it works. However, when I change back to "Network Service", which is the default setting, it won’t.

    Can you help me ?

    Nicky

    Email : nicky@i-cyber.com.hk

  36. Xinwei Hong says:

    Can you use eventvwr.exe to check the eventlog for SQL Browser and post what are the failing error message when you run SQL Browser under Network Service account?

  37. Valeen says:

    Can you help me? Please. Ugh.

    I’ve been asking for help on the forums and haven’t been able to fix the error yet. I’ve tutorialled and searched and played around and nada. I’m still getting error 26 when I try to log on to the website.

    I can ping the machine, I have firewall expceptions for both .exe files, tcp 1433 and 4774 and also udp1434. And sqlbrowswer is running.

    More of my explanation can be found here:

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2402063&SiteID=1

    PLEASE! help me.

  38. Xinwei Hong says:

    Valeen, I replied to you in the forum. Can you provide more information there? Thanks.

  39. Valeen says:

    perfect! and I’ve replied to you.

  40. Henry says:

    I have an instance, which I can connect to remotely with osql. But with Management Studio, I end up with Error 26. Any ideas? Thanks.

  41. Pramod says:

    Really really good soluion..

    particularly 4 point 1434 sqlbrowser.exe in firewall

    i wasted almosted half day to get this..

    thank u

  42. LT says:

    This is too cryptic for me: "i fixed sql server.. I connect direct to instance with port.. i’m not using sql browser.. and it works fine.. thx :)Monday, June 11, 2007 1:28 PM by pRoFiOn "

    Is there an overview of how "Create User Wizard" works?

    I can’t get it to work.  I’ve looked here and in VS 2005.  I’ve configured tool -> connect to database, and under options too.  Each time the connection test works fine, but not the Create User Wizard. I’ve started and stopped the SQL Server Service; I’ve dropped and recreated a test database.  All this is done to no avail. The β€œerror 26” message is not very useful although long.  I know that TDS stands for tabular data stream.

    I’ve looked elsewhere and there are references to the web config file.  Again the material is vague.

    With SQL 2005 Dev Edition and IIS 5.1 on an XP sp2 install.  What does Visual Studio 2005 Standard Edition do with respect to the Create User Wizard?

    Thanks in advance!

    LT

  43. LT says:

    Make aspnetdb with aspnet_regsql.exe seems to be the solution to not getting the error 26 in my case.  I got the information from http://forums.asp.net/t/1150188.aspx

    In that database there is a table called aspnet_Users that should hold users created by the "Create User Wizard" – again I got that info off of the Web.  

    It works with an empty table.  I use BobX123$ as a test user name with all the other entries in the dialog being the same.  The user information is being stored somewhere, but I can’t find it.  I’ve searched for multiple MDF files for the aspnetdb database, done SLQ traces – all do not yield the results I expect.  I can’t find the persistent storage of the data the wizard/control uses.

    Any ideas?

    I am willing to start fresh.  I can’t deploy technology that works magically!

    Thanks in advance.

    LT

  44. Alan says:

    In my case, my named sql 2000 instance is sitting behind a firewall seperated from the asp.net 2.0 web site. The named instance is running on TCP port 1570. My network guy has opened up that port, still I got this error. Do I have to open UDP 1434 as well? My connection string uses "server=IPAddressinstanceName", is that good enough?

    When I tried using "server=tcp:IPAddressinstanceName,1570", I got this error:

    ERROR 12/12/2007 11:35:09 PM 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: TCP Provider, error: 0 – A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)

    According to Ming LU’s blog at http://blogs.msdn.com/sql_protocols/archive/2005/12/22/506607.aspx, that could be caused by windows firewall. But, the windows firewall on the sql server is turned off. Does this still points back to my corporate firwall being the cause?

    Thanks.

    -Alan

    alan.tang@credit-suisse.com

  45. Alan says:

    After opening UDP 1434, and use "server=tcp:IPAddressinstanceName,1570" in the connection string, the problem was resolved.

  46. abid says:

    This error can happen when you don’t have administrative rights on the database. In my case I was working on one application at school, when I took it home it gave me this error. At first I thought that is the remote connection. For that reason I canceled the access to the database, and the remote was working fine. I made a new database just for check and that worked fine. So I knew that it when I transfered that application to my system, the current user did not have rights to access the database.

  47. mohan says:

    Hi I created the Database using the LOGIN CONTROLS in visual web developer !!

    I didnt done any programming !! What can i do , same 26 errors for mee too  !!

    how to see the connection strings and port details !! Help me !!

  48. zorch says:

    Hi,

    I just installed the x64 version of SQL EXPRESS Mgmt Studio onto a W2008 RC1 machine that had Sharepoint(WSS 3.0) installed.

    I am trying to connect to the Sharepoint SQL Server ( Windows Internal Database )

    I get this error msg error: 26

    thx

    zorch

  49. david says:

    I have tried everything and still no luck.

    1. Can ping server name

    2. Instance name is default MSSQLSERVER

    3. Can use SQL Management Studio to connect fine

    4. SQL Server Browser is running and confirmed with "sc query sqlbrowser"

    5. Firewall is not running on the server, not running on my local Vista desktop and there is no physical firewall in between.

    I’ve tried servernamemssqlserver and all variations of \ and //.

    Still getting error: 26.

  50. Duan Wang says:

    Thanks a lot for such a clear and pin to the point solution.  The cause of mine is that the server has two network cards with two IPs. One is for general network connection include SQL 2005 and the other is for server management. So when I use <servername>, it didn’t map to the correct IP.  So I give the IP in place of servername it worked.

  51. micharch says:

    Wow this error means your Instance doesn’t exisit. Go to your Surface Area Manager, your Instance is name after the Dollar sign: ie MSSQL$OFFICESERVERS, in this case the Instance name is OFFICESERVERS. Type your Instance behind your server name in the Server Setup Wizzard, ie ‘yourserverofficeservers’.

  52. Ryan says:

    In vista I found the culprit to be Windows firewall. Something there is blocking connections to virtual servers. I am able to connect to an original db using SQL server management studio for 2005 but connecting to any virtual servers even those on the original was a no go with the firewall enabled. Solution turn of windows firewall and go get AVG firewall from Grisoft.

  53. SQL Protocols says:

    Thanks Ryan for mentioning this. By "virtual servers", do you mean SQL Server virtual server, aka, SQL Server cluster? If that’s the case, then I have mentioned the root cause in another blog:http://blogs.msdn.com/sql_protocols/archive/2006/02/27/unable-to-connect-to-a-sql-server-named-instance-on-a-cluster.aspx

  54. Diego says:

    Great post man.

    It’s a must read.

    After following that steps everything was working OK.

  55. Hui says:

    Hi, I tested connection successfully but failed in my code. Error 26 comes back when I debug it.

    Could you please look at my connection string?

    Thanks!

    <connectionStrings>

    <remove name="LocalSqlServer"/>

    <add name="LocalSqlServer" connectionString="Data Source=localhostband;Initial Catalog=Players;User ID=test;Password=test"/>

    <add name="SqlConnectionString" connectionString="Data Source=localhostband;Initial Catalog=Players;User ID=test;Password=test"/>

    <add name="OdbcConnectionString" connectionString="Driver={MySQL ODBC 3.51 Driver}; server=localhost;database=players;uid=test;pwd=test"/>

    <add name="OleDbConnectionString" connectionString="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:bandplayers.mdb"/>

    </connectionStrings>

  56. Wolfgang says:

    I experienced these connection problems when SQL-server is not configured with default port. Workaround for this is to add the non-default-port number to the instance-name. e.g. SRV_ABCINS01, 4321

  57. Manick says:

    Try,

    serverNameinstance,<tcp-ip port number for the instance>

    Good luck

  58. Arshad says:

    What the hell is this πŸ™

    I just found that my SQL Express service was stopped automatically, I just restart it and all goes fine now πŸ™‚

  59. Mike Bosch says:

    I cannot for the life of me get connected to a remote SQL database.  I’m using ReliableSite.NET and they gave me this server/instance but I keep getting the same error 26.  I think the guy is lying to me about the port its using.  Can anyone help!?  I’ve tried everything I could find and nothing.  I’ve basically ripped apart my firewall, added all sorts of things.

    208.68.171.100MSSQL4

  60. David Diener says:

    I was unable to create a database project using Visual Studio 2008 Team Suite and SQL Server 2005 Developers Edition SP2.

    None of the these solutions worked for me. I finally discovered the solution by configurating the following in Visual Studio:

    Tools

    Options (check show all settings box)

     Database Tools

      Data Connections

       SQLEXPRESS (remove – leave blank)

      Design-time Validation Database

       [SERVERNAME] (remove – leave blank)

    good luck.

  61. Ashish Sharma says:

    I am also facing the same problem again and again. Steps that i have followed are as below

    1) I am using windows 2003 server class machine

    2) I already have sql server 2000 running on the machine

    3) Now i installed sql server developer edition 2005 on the same machine

    4) the 2005 instance name is changed so that it doesn’t conflict with 2000 instance.

    5) TCP/IP port for server and for client both are changed to avoid conflict

    6) I made sure that all required services are running fine, i.e. browser, server, agent and also verified that remote connections are on.

    7) There is no firewall in question here

    8) I just have a doubt regarding UDP port, i am not too sure how to ensure that 1434 is open, can someone guide me to that.

    Yeah one more thing i tried with above two servers on windows XP machine, then i was able to get the remote connection for both of the servers.

    But in the windows 2003 server machine i am not able to remotely hit sql server 2005, however i can very well hit the sql server 2000 machine.

    Any pointers guys.

    Thanks,

    Ashish

  62. Adam says:

    In order to run sql 2000 (server o msde) it needs to be at SP4. This stops the sql browser service losing it.

    The sql 2005 will use dynamic ports, check the surface configuracion manager to see which dynamic port is being used and see if you can telnet directly to that port from  you XP machine.

  63. Dan Colbert says:

    This post is still helping people after almost a year – THANKS LOADS!

    Dan

  64. n0o88o0y says:

    Update for windows server 2008 firewall.

  65. thank you. my instance name was incorrect.

  66. sarab says:

    Absolutely useful post. Solved my porblem of connecting to SQL server 2000 through upgrade advisor.

    Thanks a lot

    Cheers,

    Sarab

  67. Cristian Daini says:

    My aspx page works well with Visual Studio 2005, but with Visual Studio 2008 I get the Error 26.

    I have Windows 2003 and SQL Server 2005

    Thanks, Cristian

  68. Paul says:

    Terrific details….this post has given me great information.

    I have this same problem, but only on two of the 8 machines my application is installed on.  This is what is so confusing.  The conenct string is of course identical on all machines.

    Any ideas why only specific client PCs may have this problem while others do not?  I just cannot find any configuration differences between a client that works and one that doesn’t.

    All clients are WinXP SP2….

    Thanks, Paul

  69. SQL Protocols says:

    Can you check this blog and see if there is any alias configurated on the specific machines?

    http://blogs.msdn.com/sql_protocols/archive/2007/01/07/connection-alias.aspx

    Thanks, Xinwei

  70. Chris Williams says:

    Thanks – resolved my issue in an instant very nice and clear explanations

    Thanks alot

  71. Sandeep Verma says:

    Thank you so much! I was always thinking that this error is related to "Remote Connections not emabled". Finally found that Sql Browser was disabled at server. Thanks Again!

  72. Triguna M S says:

    I followed all the options except 5th. I want to know how to put UDP and sqlbrowser.exe into exception.

    What is the meaning of this?

    Please help me in this regard.

    Thank you in advance.

    Triguna M S

  73. Triguna M S says:

    My event viewer shows this:

    The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID

    {0C0A3666-30C9-11D0-8F20-00805F2CD064}

    to the user MALATHI-TRIGUNAacer SID (S-1-5-21-1787582532-113898072-582750426-1000) from address LocalHost (Using LRPC). This security permission can be modified using the Component Services administrative tool.

  74. gauri says:

    not connecting to the database(SQL server), It shows the error –  SQL Network Interfaces, error: 26 – Error Locating Server/Instance Specified.

    Kindly give the solution

  75. Perfect! Followed those simple steps and was able to find the issue (SQL Browser service was disabled in my case)

    Thanks!

  76. Join us today as we discuss The Vaccine Book b y Robert W. Sears. This is the second time that contributors of Silicon Valley Moms Blog , Chicago Moms Blog, DC Metro Moms Blog and NYC Moms Blog (along with the rest our friends throughout the blogsphere)

  77. Meg says:

    Just wanted to say thanks.. this helped.. so silly, I has the SQL Browser service stopped and forgot to start it back up again.. the simple checklist helped point that out.

  78. Diki K says:

    Thanks a lot, this solution solved my problem. It turns out that the SQL Browser service wasn’t even running. lol.

    After I enable the allow remote connections and running the SQL Browser service, everything was okay.

    Thank again.

  79. Navin says:

    Hi,

    I am writing a login functionality for my asp.net 2.0 website. I used

    the Login  wizard control from the visual studio 2005 tool panel and drag it over

    to my asp.net webpage. In my development pc, it works without any

    error. I noticed that it creates the following in my App_Data folder

    ASPNETDB.MDF

    aspnetdb_log.ldf

    When I migrate the App_Data folder over to the domain page and

    test the login feature again, I get the following message. Any help is

    greatly appreciated for this beginner.

    Thanks for reading my post..

    error message:

    Server Error in ‘/’ Application.

    ——————————————————————————–

    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)

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Data.SqlClient.SqlException: 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)

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

    Stack Trace:

    [SqlException (0x80131904): 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)]

      System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +800131

      System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +186

      System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject) +737554

      System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +114

      System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +421

      System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +181

      System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +173

      System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +133

      System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +30

      System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +424

      System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66

      System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +494

      System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +82

      System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105

      System.Data.SqlClient.SqlConnection.Open() +111

      System.Web.DataAccess.SqlConnectionHolder.Open(HttpContext context, Boolean revertImpersonate) +84

      System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation) +197

      System.Web.Security.SqlMembershipProvider.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object providerUserKey, MembershipCreateStatus& status) +3629

      System.Web.UI.WebControls.CreateUserWizard.AttemptCreateUser() +305

      System.Web.UI.WebControls.CreateUserWizard.OnNextButtonClick(WizardNavigationEventArgs e) +105

      System.Web.UI.WebControls.Wizard.OnBubbleEvent(Object source, EventArgs e) +453

      System.Web.UI.WebControls.CreateUserWizard.OnBubbleEvent(Object source, EventArgs e) +149

      System.Web.UI.WebControls.WizardChildTable.OnBubbleEvent(Object source, EventArgs args) +17

      System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35

      System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +115

      System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +163

      System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7

      System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11

      System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33

      System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746

    ——————————————————————————–

    Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433

    webconfig file:

    <?xml version="1.0"?>

    <!–

       Note: As an alternative to hand editing this file you can use the

       web admin tool to configure settings for your application. Use

       the Website->Asp.Net Configuration option in Visual Studio.

       A full list of settings and comments can be found in

       machine.config.comments usually located in

       WindowsMicrosoft.NetFrameworkv2.xConfig

    –>

    <configuration>

     <appSettings />

     <connectionStrings>

       <remove name="LocalSqlServer" />

     <add name="LocalSqlServer" connectionString="Data Source=.SQLEXPRESS;AttachDbFilename=C:Inetpubvhoststeleaccount.comhttpdocsApp_DataASPNETDB.MDF;Integrated Security=false;User Instance=true ; uid= priyajulie ; pwd=priya_julie "/>

     </connectionStrings>

       –>

     <system.web>

       <!– file:///C:Usersnavibingo20DocumentsVisual Studio 2005WebSitesjupitel siteWeb.sitemap

               Set compilation debug="true" to insert debugging

               symbols into the compiled page. Because this

               affects performance, set this value to true only

               during development.

           –>

       <authorization>

         <allow users="navin" />

       </authorization>

       <roleManager enabled="true" />

       <authentication mode="Forms" />

       <pages enableEventValidation="false" />

       <compilation debug="true" />

       <profile>

         <properties>

           <add name="loginname1" defaultValue="" />

         </properties>

       </profile>

       <!–

               The <authentication> section enables configuration

               of the security authentication mode used by

               ASP.NET to identify an incoming user.

           –>

       <!–

               The <customErrors> section enables configuration

               of what to do if/when an unhandled error occurs

               during the execution of a request. Specifically,

               it enables developers to configure html error pages

               to be displayed in place of a error stack trace.

           <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">

               <error statusCode="403" redirect="NoAccess.htm" />

               <error statusCode="404" redirect="FileNotFound.htm" />

           </customErrors>

           –>

    <machineKey validationKey="4BFB8F1F6611EA4E4621888B5828003FF5EC98916ABEB3163BD0F29A5B19DD1BF9BACF4CD7F37F0A07378A651DDC77F5AA3BC731E652AE355D02631064803845"

    decryptionKey="5951A42B1F6420EDDB8828738FDD8305D94559728BBBF48A" validation="SHA1" />

     </system.web>

    </configuration>

    is it necessary 4 me to install the sql server Management express edition in my hosting server ??

  80. ER says:

    4) Make sure SQL Browser service is running on the server.

    THANK YOU! my browser service was disabled, this fixed it, this was causing me no end of trouble…

  81. NEHA says:

    Hai ,

    I had downloaded the sql management studio express and i tried to login …

    Then i got a connect to server dialogbox where i need enter

    Server Type  

    Server Name

    Authentication

    Username

    Password.

    I am using my home machine and its not connected to any other computers.

    So how can i find the server name(is it the name of my computer and how can i find its name )..without that i am not able to connect.

    i am gettuing this error 26 error location server/instance specified.

    wht can i do

    pls help meeeeeeeee

  82. Promo says:

    Not all Error 26 is caused by remote things. It could also be the machine.config setting or provider issues. Read this:

    http://www.aquesthosting.com/HowTo/Sql2005/SQLError26.aspx

  83. Wilson says:

    I got the same problem before but after I replace the machine name with the actual IP address it works great.

  84. Bhavesh says:

    I tried to connect using ServerNameInstanceName. It gave me error 26.

    I tried to connect using ServerNameInstanceName,portNo – It succeed.

    After 1/2 hour, This error was automatically resolved and i was able to connect using ServerNameInstanceName again.

    Taking Option 3, I suspect it was DNS Issue.

    Questions:

    1. Where can I get log entry of DNS connection failure?

    2. If it was DNS then why it connected using ServerNameInstanceName,portNo ?

    I was able to ping the server and also able to remote desktop using servername.

  85. Bivash says:

    Thanks for your help.It really works.

  86. Mr. DBA says:

    David Diener’s comment helped me fix a VS 2008 db project creation error.

    I realized its not a bug, but a feature, cause we didnt have a LOCAL install of sql on the dev box, something required for the DB pro edition of vs2008

  87. Arun says:

    Hey

    Ok this is the problem i am having. I am connecting to the databases using Microsoft Sql server management studio . So i have server A which can connect to a name instance in server B using sql authentication . I use this as a test before i start a windows service from A which connects to B using a connection string . All this works ok as A and B are on the same LAN

    however i now have a server C which is excatly the same as A with the exception that its connects to B through a WAN. Once again i use the Microsoft Sql server management studio and it keeps giving me error 26 . i have done all the steps above and Server C can ping Server B . Please advise if there is anything else i can check? . Do i have to add and alias in Server B for server C?

  88. Xinwei Hong says:

    Looks like a firewall on the way between B and C blocks SQL Browser packet (on UDP port 1434). If that’s the case, you may have to use alias (should be on C, client machine) or use TCP port # directly.

    Thanks.

  89. Hey there, thank you for a great post.

    I’m running a Windows 2008 with SQL 2005 and have a Windows 2003 for my sharepoint. I found out that as default the SQL configuration dosn’t open up the UDP port discussed. So I opened it up, and voila, it worked. Now my sharepoint server is happy configuring.

    Thanks you again

    Regards

    Nicolai

  90. Raj says:

    Hi,

    On my live server, there 3 inserts query one after the other. Firts insert takes place successfully as I have rechecked in db but when I try 2 insert 2nd query I come across this error. Can you help me with it.

    I dont think this is an issue with connection string as insert takes place correctly first time.

    Any idea wht mkes this erro trigger only at second time??

    Thanks in advance

  91. SQL Protocols says:

    Raj, can you post the inserts you are running? Please post a question on the forum I mentioned above. Thanks.

  92. Mangaiyarkarasi says:

    Great Post. We had cluster set up and faced the issue. With this post mentioning about SQL browser, browser service in one of the nodes was not running and when started, things worked out.

  93. Charles says:

    My situation:  SQL2000 and SQL2005 named instances on WinXP x64.  Getting error 26 when trying to create SQL2000 database project using Visual Studio 2008 Team Edition.

    Running the SQL 2005 Browser and database.  Added all the services and ports to the firewall, then turned the firewall off and stil getting the problem.  Added the named instances to the hosts file along with the IP addy, to no effect.

    Running Spybot (but no error message regarding the failed connection).

    Removed the Database Connections and Designtime Database configurations, with no effect.

    Noticed that Visual Studio 2008 requires a SQL Server 2005 database instance for performing design time validation (!)

    Tried several ways of naming the local SQL 2005 instance as the design-time database, to no effect.

    Changed the SQL 2005 instance from the local admin account to my personal domain account (with local admin privileges) to no effect.

    Used ".SQL2005" as the configuration for the design-time database (i.e., ".{instancename}) and now, finally, I’m able to create the design-time database and load the project !  I note that my company uses certificates for authentication of local machines and domain users on the network.

    Why can’t MSFT add these directions and steps to a HelpFile and LINK IT to the error message that pops up, instead of giving us the cryptic error 26 message?

  94. bill says:

    Charles:

    Networking uses a mail primitive. When you send mail to someone whose address is unknown to the post office, you learn of that fact by the post office returning your mail to you (you see "address unknown"). You might wish that the post office could do more, but obviously could not :).

    In other words, error 26 can’t provide you the steps to resolve the error, because Microsoft has no idea what has happened, apart from there being an "Error Locating Server/Instance Specified".

    You might say "Aha! But my mail recipient can register their new adress with the post office!".

    And you would be correct (albeit hopeful). Address forwarding is in essence what the SQL Browser service does, and it relies upon UDP 1434 packets to provide that service. Thus if UDP 1434 is blocked the Browser Service cannot perform address forwarding.

    Even address forwaring will not word when you use the wrong name. For example, you appear to have a machine with an instance that is named "<machine_name>SQL2005", which is not the same name as "<machine_name>" and is not the same name as "SQL2005". The dot is shorthand (a nick name, if you like) for a local machince name, thus ".SQL2005" worked. But for other clients (on other boxes) to be able to connect to this SQL Server, the name ".SQL2005" will not work. Instead, those clients will need to use the *complete* SQL Server name, which is "<machine_name>SQL2005".

    Since named instances use dynamic ports, you also need to specify the port (at the client), or you  need to ensure that SQL Browser’s (i.e. address forwarding’s) UDP 1434 packets can reach those clients.

    Finally, "TCP/IP" and "ports" are not Microsoft technologies – they are standards that Microsoft adheres too. I agree they are frustrating to troubleshoot, but those standards are the backbone of the Internet, which makes them very important :).

  95. freddyccix says:

    Well my problem is this error message (error: 26 – Error Loc……..)

    but:

    -can’t connect to SqlServer Express 2005 on my network server from my application while ITS RUNNING. What I mean is that when I use Server Explorer Window on VS2008 every thing is fine (I can even insert and modify data from server explorer), in fact, when I use Datatables and I choose to preview data through TableAdapters (Design Time) I get data, and also can run the queries from there directly to the data base, but when I’m debbugin the application I get this error.

    -when I run Sql Server Management Studio, its also fine, even though I can’t see the Sql instance on the server (or any of my partners machine). But if I type the server path (servernameinstance) everything is OK.

    -I know the problem is not the connection string ’cause my partners and I use the same one to connect to the server, and no one has this problem.

    -also tried to shut down my firewall and the server’s also, and nothing.

    -ok here are the specs for both, server and client pc:

      SERVER:

    *Running Windows Server 2008 64 bits

    *Sql Server Express 2005 SP2 x86 (WOW)

      Client:

    *Running Windows Vista Ultimate SP1 64 bits

    *Sql Server Express 2005 SP2 x86 (WOW)

    *Sql server 2008 Enterprise 64 bits

    *VS 2008 Team Suite.

      Everyone Else:

    *Windows Vista ultimate 32 bits

    *Sql Server Express 2005 SP2

    So can you help me?? please, I’m working localy only, so is a pain doing this

  96. bill says:

    freddyccix:

    Regardless of whether SQL Server (Express) is running or not, error 26’s message reveals the service cannot be _found_. When "you" are debugging ("when I’m debbugin the application I get this error"), _where_ is it that your debugging process is running? Are you debugging at a client to SQL Express, or are you debugging locally, on the SQL Express box?

    And what do you mean by "I can’t see the Sql instance on the server"? Who is "I", and_where_ is "I"? Isn’t "I can’t see the Sql instance on the server" synonymous to error 26’s message?

    After attempting to answer my questions (which are aimed at getting you to think about this problem in terms of client/server architecture :)), see the "Neworking Support" section of "SQL Server 2005 Express Edition Overview" (http://msdn.microsoft.com/en-us/library/ms345154.aspx). Then see the other suggestions on this page (such as ensuring the browser service is running).

    I see others have asked how to verify whether UDP port 1434 traffic has been filtered: Try Portqry.exe (there are many other such utilities available, also called "port sniffers"). Shutting down "known" firewalls simply means that _unknown_ firewalls are left running…. Similarly, a group policy can be created (by your employer, unknown to you) to block UDP port 1434 traffic (another reason for sniffing ports). You can also inspect the errorlog, to see what port SQL Express is listening upon, and then you can temporarily specify that port within your connection string (as a way to isolate the issue to unknown filtering of UDP port 1434 traffic, should your temporary port-specified connection string succeed).

  97. bill says:

    freddyccix:

    Regardless of whether SQL Server (Express) is running or not, error 26’s message reveals the service cannot be _found_. When "you" are debugging ("when I’m debbugin the application I get this error"), _where_ is it that your debugging process is running? Are you debugging at a client to SQL Express, or are you debugging locally, on the SQL Express box?

    And what do you mean by "I can’t see the Sql instance on the server"? Who is "I", and_where_ is "I"? Isn’t "I can’t see the Sql instance on the server" synonymous to error 26’s message?

    After attempting to answer my questions (which are aimed at getting you to think about this problem in terms of client/server architecture :)), see the "Neworking Support" section of "SQL Server 2005 Express Edition Overview" (http://msdn.microsoft.com/en-us/library/ms345154.aspx). Then see the other suggestions on this page (such as ensuring the browser service is running).

    I see others have asked how to verify whether UDP port 1434 traffic has been filtered: Try Portqry.exe (there are many other such utilities available, also called "port sniffers"). Shutting down "known" firewalls simply means that _unknown_ firewalls are left running…. Similarly, a group policy can be created (by your employer, unknown to you) to block UDP port 1434 traffic (another reason for sniffing ports). You can also inspect the errorlog, to see what port SQL Express is listening upon, and then you can temporarily specify that port within your connection string (as a way to isolate the issue to unknown filtering of UDP port 1434 traffic, should your temporary port-specified connection string succeed).

  98. Kurt Johnson says:

    When I had this issue, I also had to set Hide Instance to No. Somehow, this setting flipped to Yes (or, I did it).

  99. Toyin Fatuga says:

    Thank you so much.  I spent hours trying to figure this out and am glad I found this blog entry.  For me the server/instances was wrongful specified.

    Thx.

  100. noha says:

    thanks alot it hepled me specially

    run the sqlexpress browser

    close the firewall

  101. Bob says:

    Thanks a bunch! saved my bacon.  Very clear explanation and simple instructions.

    you are a star.

  102. Matt says:

    Thanks, This is the best solution yet, it really covered more than what most others do.

  103. Bret says:

    Thank you so much for this. You’re right; really a simple issue, and yet I totally overlooked the obvious. Once I read the post, I was able to calm down, trace the problem logically, and get it working. Thanks again!

  104. Nitu says:

    Hi

    I am using WebPart in VS 2008 and i am getting this error:

    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)

    i tried everything but not able to resolve the issue

    Please help

  105. Nitu says:

    Hi,

    I have solved this issue after installing sql server express edition.

    many thanks

  106. Nitu says:

    Hi,

    I have solved this issue after installing sql server express edition.

    many thanks

  107. Keyur Shah says:

    fade up with following error

    i installed sql server 2000 and want to connect that from network it gives following error:

    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)

    connection string:

    <add key="cnstr" value="Data Source=RNDRND;Initial Catalog=GTC;User ID=test;Password=test;Connection Timeout=60;"/>

    give me some solution on this

  108. SQL Protocols says:

    Keyur Shah,

    Do you already have any SQL 2005 or 2008 instance on your box before you install SQL 2000 instance? If so, you could see this issue and please refer to the following link:

    http://support.microsoft.com/default.aspx?scid=kb;en-us;905618

    Thanks.

    Xinwei

  109. PatternExon says:

    I think step 1 is most important. After 4 hours of searching around – it was a typo in the connection string in my App.Configuration

  110. Jerry Barrett says:

    Hi

    I too am struggling with this error on MS Accounting 2008.

    I have an SBS2008 server with SQL 2005 Express running with an instance for the trend micro security app and a seperate instance for the apps, called smallbizapps. The server is called alpha.

    I have Business Contact Manager connected to a database on the instance alphasmallbizapps and I want to integrate the Accounting package (one of Microsofts selling points)

    When I try to direct the Accounting package to the same instance it refuses to connect with the error 26.

    I have tried all manner of / permutations, there are no firewalls running, well the windows ones are switched off, no others installed.

    I can access the databases from the server side with the SQL 2005 Express manager and checked the surface area configuration for the instance – its both TCP/IP and named pipes.

    The SQL Browser is running and has been restarted a number of times. Errrrm, running out of Ideas, this seems to be the last stage in getting these apps working and I’m stumbling

    Can anyone help me please.

    Regards

    Jerry

  111. Brent says:

    I have a vendor trying to connect through vpn to SQL server 2005 clustered database. I have 4 physical machines and 3 database instances. He can connect through ‘SQL Server Management Studio’ to the default instance but when he tries to connect to the other 2 databases, he gets the following error: "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) (Microsoft SQL Server)"

    Any suggestions would be helpful?

  112. Brent says:

    according to the DBA, All three SQL instances allow remote connections.

  113. Xinwei Hong says:

    Jerry Barrett,

    What do you mean by:

    When I try to direct the Accounting package to the same instance it refuses to connect with the error 26.

    Are your machines on a domain?

    Thanks,

  114. Xinwei Hong says:

    Brent,

    Can you check http://blogs.msdn.com/sql_protocols/archive/2006/02/27/unable-to-connect-to-a-sql-server-named-instance-on-a-cluster.aspx

    ?

    Another possiblity is that your VPN blocks the unmatched UDP packets.

    Thanks.

  115. ruIn777 says:

    I’m getting this error and am not sure where to start to fix this. everything I use to connect with (i.e. Server Name, Windows Auth., User Name) is given to me by default. I’m just trying to connect to a developmental server on my system right? This is an issue I’ve recently come across trying to upgrade the 2.0 .NET Framework to 3.5, SQL server 2008, and Visual Studios 2008. I’ve since then removed most of those but I’m now getting this error. Does anyone have any ideas or is this just a I.D.10.T error?

  116. Redninja says:

    Thank you for posting this my problem was caused by the Win Server 2008 firewall.

  117. Naveen D. says:

    I had no luck trying to connect remotely to my SQL Server 2005 (STD Edition) instances running on XP Professional from Server 2003.

    Came across this from Microsoft that solved my problem:

    http://support.microsoft.com/kb/914277

    The extra step is to Create an exception for SQL Server 2005 in Windows Firewall.

    Hope this help

  118. Vinny says:

    I hope I won’t forget it next time : 4) Make sure SQL Browser service is running on the server.

    I’ve been looking for a while to get this working…

    Thx for the post!

  119. dieter.stalmann@gmail.com says:

    Hi

    Here is my situation:

    – I have written an app in VB6 (yeah yeah, I know) that uses ADO to connect to SQL Server 2005 Express, but it works!

    – I am running Windows XP on my PC

    …..

    – I have installed the app on another PC, and copied the database (rQ.MDB) onto that PC as well.

    – The mentioned error appears.

    Question: Do I have to install SQL Server 2005 on every PC that needs to access the database to make it work?

  120. Kvansh says:

    Step5 corrected the condition on my named installation of SQL2008.

  121. SharkBait says:

    Not being a techie myself, how would I go about achieving this? Or are you saying that I have to install SQL Browser onto every PC that will be using the database?

  122. SQL Protocols says:

    SharkBait,

    SQL Browser is only needed on a machine with SQL server, not on all client machine. Did you try to disable firewall? Does your case apply to the corner case I mentioned in this blog?

    Thanks,

    Xinwei

  123. Jamar says:

    I have the default instance installed MSSQLSERVER, the SQL Browser running, and SQL Server running.  I can connect to the SQL Server Management Studio without any problems, but I can’t connect to my database from Visual Studio.  The same error 26 is still showing up.  I dont’ get it.

  124. jose says:

    after A LOT of hours, some friend found the key… ANTIVIRUS!!! it was the bloddy antivirus and its "hidden" personal firewall… that was it.

  125. deVbug’ s Blog is powered by Textcube 1. 7. 7:

  126. JPGarcia says:

    I had the same problem and started when installed .NetFramework 2 SP1, after removing it, the problem disapears

  127. Stu says:

    I will have your babies.  Thanks very much!!! πŸ™‚

  128. Jor says:

    I don’t have a sqlbrowser.exe service. How can I install this after sql2000 has been fully installed?

  129. SQL NooB says:

    thnx to this….

    my Biggest problem were solved..

  130. I have 2-node SQL Server 2005 Cluster which configured as Active/Passive mode, let say A node and P node. I already install 1 CRM instance on this cluster before. Now I wanna to install a second 2-node cluster on these…

  131. Chris Yard says:

    I have been using Visual Studio 2005 for some time now and I created a database from with in that with no problems. The problems came when I upgraded to VWD 2008 and SQL Server 2008 Express I am now getting error 26 and like most people here I have spent hours / days looking on the net for some answers, I have posted a thread in forums asp.net and they told me to look here.  I can not do any thing any more with my database that I started up, granted there wasn’t alot in there so can start again.

    When I try and do the same as I did last time in VS2005 i.e. right click on solution explorer and add a database I get Error 26, when I try and log on to SSMS 2008 I can not select any server name.

    Please Help  Thanks

  132. Chris Yard says:

    I have been using Visual Studio 2005 for some time now and I created a database from with in that with no problems. The problems came when I upgraded to VWD 2008 and SQL Server 2008 Express I am now getting error 26 and like most people here I have spent hours / days looking on the net for some answers, I have posted a thread in forums asp.net and they told me to look here.  I can not do any thing any more with my database that I started up, granted there wasn’t alot in there so can start again.

    When I try and do the same as I did last time in VS2005 i.e. right click on solution explorer and add a database I get Error 26, when I try and log on to SSMS 2008 I can not select any server name.

    Please Help  Thanks

  133. Rajani says:

    excellent post, resolved my issue for me. i had beeen completely disabling firewall my sql server connections to work but after your post i made necessary exceptions and enabled firewall. am safer than before πŸ™‚

  134. Can anyone please help me? I know this should be easy but it just isn’t. This is the connection string I have and if you got to the url it shows the error. It keeps telling me it can’t connect or find the database and I am getting so frustrated. Any suggestions would be helpful.

    <connectionStrings>

       <add name="classifiedsConnection" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename= A2LClassifiedsDB.mdf;username=A2LCLASSIFIEDSDB; password=******; Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>

     </connectionStrings>

  135. Amar says:

    Xinwei,

    I followed the above steps and still not able to connect to SQL Server from my client machine.

    Server machine: XP SP3

    Server name: S8_SERVER

    Client machine: XP SP3

    1. Server name is correct.

    2. Instance name is correct. ( I am just trying to connect to the SQL ServerInstance using SQL Server Mgmt Express Studio so the connection string is just ServernameInstanceName )

    3. Ping the server machine from client and vice versa

    4. ServerInstance

    – SQL Server Instance is running on the server

    – SQL Browser is running on the server

    – Tried restarting both and restarted the machine

    5. Firewall is off on each machine.

    I am still getting error 26 when I try to connect to the serverinstance from the client machine.

    It happened when our customer’s server machine locked up so they restarted their server machine. After rebooting the server machine never were they able to connect to SQL Server from any of the client machines. Therefore, it has to be something on the server thats different now than it was before restarting.

    As far as the SQL Server Instance:

    – TCP/IP, Mapped Memory, Named Piped are all enabled.

    – TCP/IP uses dynamic port and no static port.

    Please advise.

    Thank you in advance,

    Amar

  136. mayurpatel says:

    re: SQL Network Interfaces, error: 26 – Error Locating Server/Instance Specified

    pls let me know what is procedure to solve this problem

  137. Sum says:

    I have tried this method and it works for me

    go to SQL Server 2005 Surface Area Configuration (found in "C:Program FilesMicrosoft SQL Server90SharedSqlSAC.exe")

    Select Surface Area Configuration for Services and Connections, Check the information in Services status if it is stopped then click on start.

  138. rvp says:

    Thanks for this great post!!!!

    Cheers

  139. Darren says:

    Hi, I have tried all the above to no avail!!  Am serioulsy about to throw something really heavy at my pc!!!!  If anyone can help i would be most appreciative!!

    I am using Visual Web Developer and set up a a few Queries in a gridview to a locally installed Version of SQLEXPRESS 2005.  Worked no probs.

    I installed SQL 2008 on the weekend, after detaching the database from 2005.  Uninstalled 2005.  Installed 2008.  Attached the database.

    Now, the gridview connects fine in Visual Web Dev.  But as soon as I try it in a browser I get the error: 26.  

    I have resintalled 2008 3 times, reinstall IIS, reinstall .NET 3.5.  There are no Firewalls, i’ve tried the database connection bug for VS. In the software development the connection string is perfect….

    Wot am i missing!!!  Please help!!!

  140. DEVESHA says:

    Very strange issue for me (many compliments for the post anyway…):

    ========

    Scenario

    ========

    The OSs

    ——–

    PC #1 – Microsoft Windows XP Pro SP3

    PC #2 – Microsoft Windows 7 RC build 7100

    The SQL client

    ————–

    SQL Server Management Studio 2008 (the same on both PCs)

    The SQL Servers

    —————

    SQL Server 2005 (company’s production environment)

    SQL Server 2008 (company’s development environment)

    both have named instances (e.g. SERVERNAMEINSTANCENAME)

    The problem

    ———–

    – When connecting to both SQL Servers (through Microsoft Windows XP Pro SP3) there are no network related issues;

    – When connecting ONLY to SQL Server 2008 [development environment] (trough Microsoft Windows 7 RC build 7100) there are no network related issues BUT when trying connnecting to SQL Server 2005 I get the error 26;

    Considerations

    ————–

    – Firewall disabled on both PCs.

    – Unable to see if SQL Browser service is running on the server (the environments are protected by SysAdmins…)

    – Tried, on Windows Seven PC, using tcp:SERVERNAMENAMEDINSTANCE and/or np:SERVERNAMENAMEDINSTANCE but got same error 26

    – Ran the portqry.exe on both OSs and both returned IDENTICAL values:

    C:> portqry.exe -n 192.168.X.Y -p UDP -e 1434

    Querying target system called:

    192.168.X.Y

    Attempting to resolve IP address to a name…

    IP address resolved to servername.domain.com

    querying…

    UDP port 1434 (ms-sql-m service): LISTENING or FILTERED

    Sending SQL Server query to UDP port 1434…

    UDP port 1434 (ms-sql-m service): FILTERED

    Question

    ——–

    Are there some hidden network security policies in the Windows Seven OS, related to SSRP UDP packet, which are sent to SQL server (behind the SQL Server Management Studio 2008) whereas portqry does not?

    Conclusions

    ———–

    I exactly know that Windows Seven RC 7100 is only a release candidate version that should NOT used in a production environment… I’ll try same tests using the Ultimate 7600.16385 RTM version and then the Windows Server 2008 R2 RTM build 7600.16385 πŸ˜‰

    See ya!

  141. DEVESHA says:

    SOLVED my strange issue:

    the Windows 7 firewall is divided into 3 distinct protection profiles

    – domain profile

    – private profile

    – public profile

    I disabled only the public profile, forgetting the other 2 profiles… so in my domain environment the network operations involved by the Windows 7 was partially blocked.

    Now, to be extremely precise, I’ve re-enabled the firewall, then added a specific rule for the domain profile (exclusively in my case because I work in a domain environment) allowing the incoming and the outgoing the network traffic both

    – for the UDP ports 1433,1434

    and

    – for the Microsoft SQL Server Management Studio program.

    Everything works fine now!

    Cheers πŸ˜‰

    P.S.: only 1 question is pending: why when connecting ONLY to SQL Server 2008 [development environment] (trough Microsoft Windows 7 RC build 7100) there were NO network related issues? Microsoft mysteries…

  142. kapptaink says:

    I had the errer 26 and tried a lot of things in alot of post to open the DB in SQL Manaegment Studio: This is the string that worked for me:

    \.pipeMSSQL$Microsoft##SSEEsqlquery

    If it dont work for you open your backup log file and search for:

    SQL Server Connection String: Data Source=np:

    What followes after that should be the string you need.

  143. Jim says:

    Thanks for documenting this – saved a lot of grief.

  144. Manoj says:

    Thanks! This is really an excellent articles. This tell where to exactly hit.ONSPOT Hats off!!!

  145. john b says:

    Thanks your blog post solved my problem with the 2008 Express on my Vista laptop. I turned off the Firewall and this allowed the SQL Browser to turn on and this fixed the problem.

    BTW, is there a way to change the ports on Express 3008?

  146. master J.Sh says:

    When I try opening some of applications recive this error with event ID:26.

    β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”

    Application popup: verclsid.exe – Application Error : The instruction at "0x0006ffa0" referenced memory at "0x000000f1". The memory could not be "written".

    Click on OK to terminate the program

    Click on CANCEL to debug the program

    β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”

    PLease help me.

  147. Yogesh says:

    Still I am getting same kind of issue

  148. SQL Protocols says:

    Yogesh, Please post a question in the forum mentioned in the blog. Please provide details as much as possible. Thanks.

  149. Jack says:

    Thanks for the article. Added a named SQL Instance to the default instance and did not reboot. SQL Browser was set to disable so I was able to connect to the default but not the named.

  150. Mick R says:

    Is it possible that some other software could have blocked ports (or something like that)?.. I have 3 workstations that we access a local network database on. For some reason, today, my workstation will not connect but the other ones still work fine (so it can’t be a setting on the server, right?).

    The connection was saved on my SQL management studio so no details have changed, however, I have installed silverlight (dont know why) and my norton antivirus has expired in the last couple of days. Could either of these things changed my configuration such that it would affect my connection?

  151. Mick R says:

    Sorry, forgot to mention, I am getting this error 26 as well, thats why i made this post. It had been connecting fine for years.

  152. R patel says:

    i am new to .net,i am using visual studio2005 for making a website (asp.net),my project was running fine,but one day i ran my registry cleaner and after that sqlserver is not working and giving error 26,in the line where i am opening the connection

    (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))

    please anyone can help me,i am so stuck with it.

  153. Nadeem Shehzad says:

    I have tried this connection string, and it works fine with sqlexpress 2005 and VS 2008:

    Data Source=.\SQLEXPRESS;Initial Catalog=MyDatabase;Integrated Security=true;

    Make sure remote connection, and TCP/IP protocol is enabled

  154. McGuire says:

    This was working, then quit.  <add name="ASPNETDBConnectionString" connectionString="Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|ASPNETDB.MDF;Integrated Security=True;User Instance=true" providerName="System.Data.SqlClient" />

    Have been thru all of the points in the article.  My network manager also checked them.  Have tried other configurations such as: adding the path:  connectionString="Data Source=.SQLEXPRESS;AttachDbFilename=c:inetpubwwwrootMyAppApp_DataASPNETDB.MDF;Integrated Security=True;User Instance=true"

    Have tried using \ vs before server name, creating and using username and password

    Been working on this for two days…any other ideas?

  155. Xinwei says:

    McGuire,

    Did you try portqry? What did it return?

    Thanks,

  156. Derald says:

    First check that windows firewall is not enabled if you are using a Vista or Windows 7 workstation to access the DB Server. I found that even though I had disabled Windows Firewall a long while ago, that somehow (most likely through updates), windows firewall, had been re-enabled.

    However, if you desire that windows firewall be enabled, make the exceptions in the configuration.

  157. Priya says:

    Hi friends….

    I ve used login control from toolbox i.e drag n drop

    And to create user name n password i open the administer website.. it opens n when i go to security tab it shows me an error….

    The following message may help in diagnosing the problem: 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)

    Can any one find out where i m going wrong…

    Thanks

  158. TKV says:

    Thank you so much. It helps me a lot.

  159. shantanufrom4387 says:

    I too had the same problem some time back and I too tried many solutions. After that I finally decided to post this issue on my blog.

    I wrote all the steps for those who dont know how to configue router to open up the port or adding exception to the firewall. There is a video for you along with documentation to configure your setting to resolve this error.

    http://techpint.com/programming/error-26-%E2%80%93-error-locating-serverinstance-specified-sql-server

  160. Tamer says:

    That fixed my error,

    It seems that UDP packets are dropped on my network due to some problem.

    I just used the "tcp:" qualifier and the error was gone forever.

    THANKS

  161. BI User says:

    Wow! This is very helpful. This post helped after upgrading my desktop

  162. Siraj Syed says:

    cool this was really easy to solve.

    Thanks πŸ™‚

  163. DBA says:

    We are getting this error (26) when trying to connect to a named SQL 2008 instance on a Windows 2008 cluster.

    The only time we get the error is when trying to connect via SSMS. We can remote to the machine, our diagnostics tool can connect to it, applications seem fine.

    But SSMS cannot connect.

    SQL browser service is started and is not being blocked by firewall.

    We downloaded portqry but it returns a status of ‘FILTERED’.

    Not sure what should be done next.

  164. Thomas Ziniatis says:

    excellent article πŸ™‚ thanks for the help

  165. Shawn Mortensen says:

    This fixed my problem, thank you for your assistance!!  I spent many hour trying different things.

  166. Ali says:

    Thankyou very much it work with me

  167. Brahim says:

    I have the best fix:

    By default the machine.config file is trying to pull the Provider information from a SQLExpress database using an invalid connection string named "LocalSQLServer". Many web servers will not have SQLExpress enabled, and will not have this value set to a valid SQL Server database that is of use to you. In a shared hosting environment, this is especially true, as it would be expected that you would want your Provider information stored in your database and not some single database shared by the other users of that web server.

    Read more on:

    http://aquesthosting.com/SQLError26

  168. Brahim says:

    quick fix in the web.config

    <connectionStrings>

       <remove name="LocalSqlServer"/>    

       <add name="LocalSqlServer" connectionString="server=127.0.0.1;database=MyDataBase;Trusted_Connection=True;" providerName="System.Data.SqlClient"/>

     </connectionStrings>

    This way you can test if my previous comment is your problem and fix

  169. rufol says:

    Thank you for this valuable info. I’m in a process to upgrade my existing to your new ideas. And in the mean time looking for some good reviews about it. I just came across a random site with some useful info about Networking articles. Here goes the link.

    http://www.adminkernel.com/networking-articles/

  170. Lee says:

    Great Blog, thanks heaps! Fixed my problem nicely.

  171. sudeepg says:

    Very good blog. Helped me resolve a problem with connectivity very quickly

  172. geeth says:

    Thanks, helped a lot! saved time

  173. shan says:

    hi,

    ive set up a connection string and whenever the program hits myConnection.ConnectionString, it will appear such an error :

    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: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server)

    with saying SqlException was unhandled.

    could u pls help?

    ive follow all yr instructions with the TCP, UDP. all of them are enabled already.

    including all the firewall ports. sqlserver and sqlbrowser both are working properly as well.

    thank u. appreciated. if u ned anymore detail, im most willing to provide it.

    rgds,

    shan.

  174. kAIN says:

    Awesome tutorial, Fix my problem in minutes, before searching for hours.

    thank’s a lot.

  175. rahul says:

    thx for the post finally resolve this error

  176. Rahul says:

    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)

    help me plz……..

  177. SQL Protocols says:

    Shan, your error is error:40, a different error. You search our blog for solution for this error or post a question in our forum.

    Rahul,

    Please follow the instruction to resolve the issue. If you still see it, please post a question in our forum.

    Thanks.

    Xinwei

  178. bcsrnd says:

    I have a 2003 development server that is running SQL 2005.  I have no problem connecting to that server with Visual Studio and editing or using the SQL database as my ASP.NET Provider database.  However when I try to run that code on the server with the same connection string, I get this error.  I don’t know why I can connect to the server remotely via my laptop’s visual studio environment but not with the server’s own IIS.  I’ve tried everything that I can think of.

  179. Matthew says:

    I am currently using SQL Server 2008 with Windows Server 2008 as my OS.  For some reason, the clients seem to randomly disconnect from the server.  When this happens I have to reconfigure my ODBC connection and then it seems to work again.  It is a continuous problem.  Any help is appreciated.  Thx.

  180. Matthew says:

    One other point – it appears to work fine when I specify the IP instead of the host name, but I would like to be able to reference the name instead.

  181. Chirag says:

    This was extremely helpful.  Thanks very much.

  182. Nitish says:

    I tried all of it…the points, the qualifier tcp,np, the ip instead of the hostname…the portqry also

    It returned my Instance name properly. it also says UDP port 1434 is LISTENING.

    The problem persists :-/

    also when my teammate tries to access the database on his system. He is able to connect and no error is shown.

    Why is it showing error to me. Being the Local Host am i nt more preveliged than my teammate >(

  183. Nitish says:

    @above…

    my teammate ca access MY DATABASE.

  184. Nitish says:

    After n number of tries… i finally solved the problem.

    My problem ws a bit specific and was because i was dealing with webparts in MS VS05.

    I solved the error by correcting my web.config file.

    Ty anyway..for the great info πŸ™‚

  185. Bhavik says:

    Thank you so much ………for this article …….

  186. elo says:

    BEAUTIFUL! THANKS FOR THIS GREAT ARTICLE. It's well written, detailed, specific.. all you can ask for in a TRUE technical posting.

  187. Mike says:

    Thx, it was the browser service set to manual and not running that caused this.

  188. Rodriiva says:

    You just saved my life.  Indeed it didn't cross my mind to check for server conectivity rather than SQL Server configuration since I was conecting to it using remote desktop.  However when I ping the server it was not responding and it was a matter of working with the firewall to enable access, port 1433 TCP, port 1434 UPD and access to Sqlservr.exe program made the trick.  Now I am up to start working on the actual application.  Once again thank you very much.

  189. Nick says:

    This is a great post, but unfortunately my problem which is similar is not fixed.

    My new laptop is unable to connect to a named instance of Prod SQL server, which I am able to connect to from my old laptop. Both laptops W2K3, SQL 2K8 SQLEM tools installed and some of my C# apps.

    I can connect to default instances to many other SQL servers, but not to any named instance from my new laptop only.

    PortQry:

    Querying target system called:

    xxxxxxxxx

    Attempting to resolve name to IP address…

    Name resolved to xx.12.141.82

    querying…

    UDP port 1434 (ms-sql-m service): LISTENING or FILTERED

    Sending SQL Server query to UDP port 1434…

    UDP port 1434 (ms-sql-m service): FILTERED

    My old laptop does not have a problem connecting with any SQL named or default. Any idea what else can I try?

  190. Nick says:

    Problem resolved

    Went in Add remove Windows Components and cleared the Network Services checkbox to uninstall DNS service, which somehow got installed.

  191. Jahan Afshari says:

    Thanks for the post! An extra backslash got into the connection string which was in a settings file in Visual Studio.

  192. Pradeep says:

    Thanks, it worked fine after enabling the SQL Server Browser Service.

  193. Amit says:

    Hi,

    Before this error it is working but how some time later showing "An error has occured while establishing a connection to the server. when conecting to sql server 2005, this failure may be caused by the fact that under the default setting SQL Server does not allow remote connections(provide:SQL Network Interfaces, error: 26 – Error Locating Server/Instance Specified)(Microsoft SQL Server)"

    Can any solve this problem

  194. Amit says:

    Hi,

    Before this error it is working but how some time later showing "An error has occured while establishing a connection to the server. when conecting to sql server 2005, this failure may be caused by the fact that under the default setting SQL Server does not allow remote connections(provide:SQL Network Interfaces, error: 26 – Error Locating Server/Instance Specified)(Microsoft SQL Server)"

    Can any solve this problem?

  195. Before I explain the issue I am facing, I would like to say that I did read the above post, but in my case the problem is transient (lasts for approximately two minutes after a failover) so items 1-3 in the list of troubleshooting steps do not seem to make sense.

    As to 4 and 5, the named instances use non-default ports (2433 and 3433 respectively), so I do not know how to tailor the PortQry command for that.

    I tried

    portqry.exe -n ServerA,2433-p UDP -e 1434

    and

    portqry.exe -n ServerA,2433 -p UDP -e 2434

    and it failed both times with a "Failed to resolve name to IP address" while the server was up and serving database requests

    The same thing happened when I tried it with the failover server as well.

    ***The issue I am facing***

    I am using Enterprise Library 4.1 to connect to a SQL Server 2008 R2 database with a mirror.

    My connection string itself is as below (with dummy values for all fields):

    "Data Source=ServerA;Failover Partner=ServerB;Initial Catalog=DBName;User ID=uid;Password=pwd;Connect Timeout=5"

    Sample .NET code is as below (with modifications to instantiate all variables locally to provide context):

    SqlDatabase db = new SqlDatabase(ConnectionString);

    SqlConnection cn = (SqlConnection)db.CreateConnection();

    cnInitTime = String.Format("{0:MMM dd, yyyy, HH:mm:ss.fff}", DateTime.Now); //To store the time when the connection was attempted

    cn.Open();

    //A dummy method to test whether connection has indeed been established. Added out of desperation πŸ™‚

    if (cn != null && cn.State == ConnectionState.Open)

    {

    cmd = new SqlCommand("PRINT 'ASDF'", cn);

       cmd.ExecuteNonQuery();

    }

    And here is what I observed happening:

    Initially when ServerA is active, everything works well.

    When Server A fails and the requests get routed to ServerB, I get a network error. Which I can understand happening on the first request. The problem is this persists for approx two minutes or so before I can get access to the ServerB from within my code.

    After two minutes with ServerB acting as primary and Server A as mirror, life is good. And when ServerB goes down, the connection seamlessly switches to ServerA without any issues.

    Digging into this further I noticed that after this line below:

    SqlConnection cn = (SqlConnection)db.CreateConnection();

    the datasource of the connection is always ServerA regardless of which server is active. However, when the database (on ServerA or ServerB) is serving requests normally, the datasource switchs on cn.Open(); But immediately after failing over to ServerB and for the next couple of minutes, this switch does not happen which means that the code is still attempting to connect to ServerA despite that failing.

    Prior to posting this, I tried handling the exception raised and clearing the connection pool and reinitiating the connection hoping that this is something transient that will go away.

    catch (SqlException se)

         {

           try

           {

             if (cn != null)

             {

               SqlConnection.ClearPool(cn);

               cn = new SqlConnection(connectionstring);

               cn.Open();

               cmd = new SqlCommand("PRINT 'ASDF'", cn);

               cmd.ExecuteNonQuery();

             }

           }

    }

    This still gives me a network error.

    This is driving me nuts and I would really appreciate it if you could shed some light on what I am doing wrong here.

    (If it helps, for testing purposes, the servers are cycled by a SQL job which brings one server back up and once it is back up,, takes down the other server which was serving requests)

    Thanks

  196. bishwanath says:

    thanks for this great information. this really eased my preasure

  197. Deepa Neelesh Nair says:

    Hi..

    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.

    Go to

    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.

    ie.

    in

    All Programs->Microsoft SQL Server 2008-> SQL server Management studio

    use your aliase as your server name

    Hope this will work..

  198. Sarath says:

    Thanks a lot. By enabling the SQL Browser service. I was able to connect to one of SQL Server instance.

  199. Robert says:

    I have been trying to connect to PCNAMESQLEXPRESS 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:

    PCNAME.cable.virginmedia.net

    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?

  200. Robert says:

    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.

    http://www.virginmedia.com/…/feedback.php

  201. Ervin says:

    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?  

  202. Nullagain says:

    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!

  203. Eddie says:

    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

    any clue??

    Thanks!!

  204. Naimlatifi says:

    Hi everyone,

    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

    ID=username;Password=password")

    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 !

    Regards,

    Naim

  205. Liam Caffrey says:

    Hi,

    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_AddressInstance_Name and tcp:IP_AddressInstance_Name,1433, etc, etc. Nothing works.

    Has anyone any idea?

    Regards

    Liam Caffrey

  206. TS says:

    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.

  207. Ernest says:

    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

    Error message

    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…

  208. Kanan says:

    It's Wonderful

    it gives what is required in decent way respecting users time.

    Thanks a lot

  209. Steve says:

    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?

  210. Martin says:

    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

  211. Tom says:

    make sure that SQL Server Browser (it's a service) is running!!

  212. Sh@h says:

    I had the same problem. The Windows Firewall was in the "ON" state on my local machine. After disabling it, I was able to connect to my remote databases.

    Cheers

  213. Sergio Govoni says:

    Thanks a lot for this post!!

    Today it was been very useful to me πŸ™‚

    -Sergio

  214. Don says:

    After doing an application repair for another issue, I was getting this message when trying to connect a remote client.  The issue ended up being the Browser Service, which was disabled by the repair process.  Thanks for this post!  Could have spent hours trying to figure out what else it could have been.

  215. Azzy says:

    Thank you very much Hong… Very specific and right on target…

  216. Raul says:

    Thanks a lot for this, it was 4) the Browser Service not being enabled for me.

  217. Arturo says:

    Its easier check the cable may be bitten by mice.  That happened to me.

  218. Juanita says:

    Thank you so much!!! this is exactly what I needed.  

    I had never set up a named instance and sure enough,

    the browser service was not running.

  219. ahmed40@hotmail.com says:

    Great and helpful post

  220. zia says:

    thank you. after starting sql express service this error was gone

  221. Akbar says:

    Thanks alot, your article was really very helpful, sql browser service was biting whole of my time

    Thanks again

  222. PK says:

    thank u its working thanks a lot…..

    "Make sure SQL Browser service is running on the server."

  223. Shaun says:

    I had this same error on 2 of the servers in my 2010 farm after applying service pack 1 for sharepoint – the issue was that the database serverinstance name had quotes around the name and in the SharePoint 2010 Products Configuration Wizard and I could not change it. I solved this problem by copying the incorrect name and searching the register for it, when I found the incorrect registery entry, I removed the quotes and saved it. I ran the SharePoint 2010 Products Configuration Wizard and it ran successfully.

  224. Manikanth says:

    Hi I am able to connect using SQL Server Management Studio. However, I am not able to connect from SQL Server Upgrade Advisor. Can you pls help

  225. ArthurZ says:

    This article – "Problems with SQL Server Express user instancing and ASP.net Web Application Projects"

    may also be relevant to users on Windows 7 or Windows Server 2008 R2:

    support.microsoft.com

  226. Tarik says:

    Thank you very much for your article.

    I have the same problem

    I installed an Instance of sql server 2008T express edition on Windows 7 Porf., and I am trying to access it form station which has windows 7 Home Premium, When I enter the ComputerName/Instance Name I got this error, but when use an IPAddress/Instance name it connects fine.

    Can any please help me for this problem

    Thanks in advanced

  227. Kshitij says:

    I am facing the same problem. Did everything as explained above. But could not solve the problem.

  228. tiag0 says:

    I'd been struggling for 3 days with connection problems and I solved it in minutes with your blog post. I owe you guys coffee πŸ™‚

  229. chrisjbarth@hotmail.com says:

    I'm able to connect with SQL Server Management Studio. I'm able to go through the Wizard to create a table adapter, but when I click finish I get the following error:

    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) at DataObjectSupport(422,6).

    I get the same error when trying to preview data from a previously created, and formerly working, datatable. I've even recreated the connection string as part of the Wizard and I can even use the Query Builder to build the simple SELECT statement, and I can Execute Query just fine. I only get the error at the very end when I click finish.

    Any ideas?

  230. Sc8eR says:

    This worked for me. Hope it helps someone else to.

    When setting up a connection trough wizard:

    1. in Add Connection window click on Advanced button

    2. Locate Data Source property and delete it.

    this forked for me for some reason πŸ™‚

  231. Craig says:

    Thank you for this post.  Item #5 is what helped me to get it working.  Wish I would have found it much earlier…  πŸ™‚

  232. gen says:

    sql service mgt. 2008 r2 0 can't connect- configuration manager  sql services is empty-

    pls advise

  233. Stuart says:

    In my case you need to enable TCP on the server.

  234. James Pang says:

    For my case of Error 26, it is caused by reason No. 3. And I finally found the solution. I am using WinXP SP3 and Win7 both with Ms SQL Server Express R2 SP2. The symptom is I can remote connect with IPaddressSQLinstance but not PCnameSQLinstance.

    For testing, I open up command prompt (cmd.exe) at Server PC. Enter "ipconfig" and I get Server IP Address as 192.168.1.6 (for example). Let say the Server PC name is "ServerPC"

    Then at Client PC, open up cmd.exe and enter "Ping <Server PC name>". For this case, it is "Ping ServerPC". The results are:

    C:>ping serverpc

    Pinging serverpc.Home [202.71.99.194] with 32 bytes of data:

    Reply from 202.71.99.194: bytes=32 time=305ms TTL=50

    From here, the returned Server IP (202.71.99.194) is different from the actual IP (192.168.1.6). So, SQL cannot do remote connection with Server PC name. Here is what I did to solve this.

    WinXP

    1. Go to Network Connections (WinXP: Start->Connect to->Show all connection)

    2. Right click on "Local Area Connection" (or the connection you use for SQL, such as Wireless Network Connection)

    3. Select Properties

    4. Previously, I only have "Internet Protocol (TCP/IP)" with obtain an IP and DNS address set to automatic.

    5. So click Install… select Protocol, click Add…, select "Microsoft TCP/IP version 6" and click OK.

    6. You will be prompt to restart PC.

    Win7

    1 to 3 same as above

    4. I have "Internet Protocol Version 6 (TCP/IPv6)" and "Internet Protocol Version 4 (TCP/IPv4)". Select IPv4 and click Properties.

    5. "Obtain an IP address automatically" is selected

    6. At bottom, select "Use the following DNS server addresses:

    7. Key in Preferred DNS Server and Alternate DNS Server for your internet provider. For me, I am using Streamyx from Malaysia. So the Preferred DNS is: 202.188.0.133 and Alternate DNS is: 202.188.1.5

    After the change, open cmd.exe and enter "Ping <Server PC name>" or "Ping <Server PC name> -4". The returned IP should be the same as the actual IP. Then use SQL Management Studio to test remote connection. Remember to make sure the other reasons are covered before doing this. Hope it helps.

  235. sql-troubles says:

    I would check which Ports are actually used on the given instance, for example with the following DMV query:

    SELECT DISTINCT EXC.endpoint_id

    , EXC.local_net_address

    , EXC.local_tcp_port

    FROM sys.dm_exec_connections EXC

    WHERE EXC.endpoint_id IS NOT NULL

    For named instances the ports can be different than the expected ones.

  236. andre says:

    THIS IS USELESS… HOW DO I MAKE SURE OF EVERYTHING YOU JUST SAID?????

  237. unknown says:

    Hello,

    By mistake I have deleted SQL Server browser service using the command "sc delete SQLBrowser". Now how to re-install it? Pls help me regarding this.

  238. Raul says:

    "After A LOT of hours, some friend found the key… ANTIVIRUS!!! it was the bloddy antivirus and its "hidden" personal firewall… that was it."

    Thanks a lot, that was my issue.

  239. Tom says:

    Yay! Step 5 (UDP 1434) is the bomb! Thank you for the post.

  240. Mani says:

    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)

  241. JNB says:

    6) Try running your program from a local drive, not a network drive.

    I had this problem on some computers but not others, and tried using ADO.NET versions 3.5 and 4.5.  The easiest way to confirm the server/instance and permissions is to create a .udl file and use it to "Test Connection".

  242. ash says:

    make sure your sql services aRE running.

  243. Zahra says:

    Thanks.. I was caught by #4 on the checklist.

    I just had to start "SQL Server (SQLEXPRESS)" service through Computer Management > Services and Applicaitons > Services

    If it's not giving you the option to "Start" the service, you need to set the startup type to "Automatic" under SQL Server (SQLEXPRESS) properties > General tab.

  244. NP says:

    Excellent post! One day suddenly we were not able to connect to any of the named instances on one of our servers from any other machine. The Sql server instances were up though. After reading this post, I checked the status of UDP port 1434 using PortQry command and it showed as FILTERED. I restarted "Sql server browser" service and tried again. Now the status of the port changed to LISTENING and I was able to connect to all the named instances without any issues.

  245. Mo says:

    Hi guys, all my domain controllers died. Rebuild them from scratch, no system state restore perfromed. tried to connect my the sql server, get an error"error locating instance/server"

  246. Ponyist Péter says:

    (hu-HU, 1250) A cikked jΓ³ ΓΆtletet adott, aminek segΓ­tsΓ©gΓ©vel ki tudtam javΓ­tani egy problΓ©mΓ‘t. KΓΆszΓΆnΓΆm!

  247. krylon says:

    I just had this very problem on SQL Server 2008 R2 – activating the SQL Server Browser service solved the problem, so I set it to start automatically.

    Thank you very much!

  248. ibrahim says:

    thanks. Good article and save my time.

  249. Umberkar Sushil says:

    How to solve this error

    error: 26 – Error Locating Server/Instance Specified

  250. David A says:

    I received the following error after installing SQL Server 2012 and attempting to connect via SSMS.

    1. A network related or instance specific error occurred while establishing a connection to SQL Server.

    2. The server was not found or was accessible.

    3. Verify that the instance name is correct and that SQL Server is configured to allow remote connections.

    4. (Provider: SQL Network Interfaces, error: 26- Error Locating Server/Instance Specified) (Microsoft SQL Server)

    My solution: I adjusted the windows firewall and the error did not remain.

    My question is as follows.

    Must a TCP/IP port number be assigned to the SQL Server DB Engine if you do not plan to connect to a network or try to access the DB from another machine?  

    I installed SQL 2012 on my home PC in order to prepare for a certification exam exclusively.

    Thanks

  251. ΰΈ§ΰΈ΄ΰΈ™ says:

    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) (.Net SqlClient Data Provider)

  252. Saykor says:

    4) Make sure SQL Browser service is running on the server.

    This was my problem. When I run it all works.

    Thank you

  253. Adam says:

    Thank You Xinwei,

    The trouble was with the UPD 1434 port in firewall.

    The SQL was finding itself of course, however another Hyper-V server (on another IP address) was not finding the SQL.

    Many thanks again

  254. Quan says:

    Hey thanks, the SQL Server Browser part did it for me.

  255. Anthony Graham says:

    This post solved my issue.  Thank you πŸ™‚

  256. Robert says:

    La soluciΓ³n final es PortQry, la ΓΊnica manera de darme cuenta que faltaba el UDP.

    Muy buen Post

  257. SABA says:

    first start sql serverexpress on service.msc it also one of the the right solution

  258. Gloucester says:

    This solved my problem ,had the same error message today

    Create a new query and copy and past the following two lines after execute  :

          –delete from logs.RequestLog

          Select * from logs.RequestLog

    the execute

  259. Yran Pascoal says:

    Thank you! The SQL Browser service was stopped. After start it all worked perfectly.

  260. Harish Shikhare says:

    I have tried

    1. closing VS 2013.

    2. Re-start IIS

    3. Rename IISExpress folder

    4. Restart Computer

    5. Things started working

    Good post..

    Harish S.

  261. Bhanu says:

    Good post…Very informational.

    Thank you for sharing.

  262. Tariq Shahzad says:

    Great Post Dear,

    UDP Port fix the issue.

  263. RedSlayer says:

    LMAO – Server (with SQL Server Express) had firewall.

    Hmmm – may change jobs.

  264. Jayashri Aher says:

    This error occurs If you change your system Name or computer name. When you installed sql server it take Default computer name . After change computer name this error:26 is occurs. To resolve purpose you Change your computer name as Previous Name which is default when you installed sql server

  265. Rik Thwaites says:

    Finally a google search which actually returned an article which has fixed my issue completely, brilliant post!

  266. Vitor says:

    Thank you very very much! You saved my day!

    πŸ˜‰

  267. Lestat says:

    i have dawn firewall(i think  this open all ports)  and authentication sql server is mode windows,  I still have the same problem

  268. Giri Babu says:

    I have connected  principal system,Mirroring system and witnesses in witnesses systems but not able to connect witnesses system in principal system..

  269. chien says:

    just  open configuration tools/ sql server configuration manager/sql server services/ and start sql server (SQLEXPRESS) it works for me

  270. Mahmoud Ghandour says:

    Hello, I cannot start the SQL Browser service. When I'm trying to run this service it keeps giving me "Access denied"

  271. Mahmoud Ghandour says:

    Thank you very much … .. a new perspective to look into this.

    Helped me in diagnostics. Finally solve this and connect successfully to my SQL DB from another PC.

    And by the way my SQL Browser service stayed in stopped state though the connection was established successfully.

  272. Mahmoud Ghandour says:

    Ok … .. before trying to connect make sure you sqlbrowser.exe service is running .

  273. shrii naidu says:

    I got a similar problem with sql server , i have tried every thing but does not connect to database engine & it shows error:26.

    First check database engine is running or not. by going into configuration manager. start > sql server >sql server configuration manager . on the right pane you should see the sql server (mss .. ) should be running state with a green indication.

    IF not the database engine is not running. simply uninstall sql server / format your system if possible and then download sql server 2012 and management studio. from

    http://www.microsoft.com/…/details.aspx

    Install server first, make sure to add server on installation phase

    by clicking add server and then install management studio. this

    should work.. πŸ™‚

    @shrii@

  274. shrii says:

    I got a similar problem with sql server , i have tried every thing but does not connect to database engine & it shows error:26.

    First check database engine is running or not. by going into configuration manager. start > sql server >sql server configuration manager . on the right pane you should see the sql server (mss .. ) should be running state with a green indication.

    IF not the database engine is not running. simply uninstall sql server / format your system if possible and then download sql server 2012 and management studio. from

    http://www.microsoft.com/…/details.aspx

    Install server first, make sure to add server on installation phase

    by clicking add server and then install management studio. this

    should work.. πŸ™‚

    @shrii@

  275. vaibhavi patel says:

    Problem while opening database connection in visual studio for C#.net project….network-related or instance-specific error occuring while connecting to SQL server.Error:26 (error locating server/instance specified)

    ANS is:

    click on control panel—>administrative tools–>services–> SQL server(SQL EXPRESS) right click on it…and start the service.

    Database connected and error will be solved.

    thats it:D

  276. Kate says:

    Thank you! Worked for me right after I allowed UDP port in Windows firewall. Great Post!

  277. Bruce says:

    My next step was to just turn off my firewall to see if that solved the problem, but it wouldn't have told which port and protocol, so good info, worked just fine

  278. Elbert says:

    Thank you for pointing out port 1434 to me.

    Great help!

  279. IanB says:

    Thank you for the great post, even 8 years later.

    This worked for me using SQL 2014

    This is definitely worth the 5 stars.

  280. SQL Enthu says:

    My issue was fixed with enabling the sql server browser.

  281. Judy Westgate says:

    This advice was excellent, running through all the options so I could check and resolve them.  Thank you, thank you.  

  282. Liudmila says:

    I have this problem:

    No pending explicit migrations.

    Why?

  283. Feba Thomas says:

    Thanks for the post.

    4) Make sure SQL Browser service is running on the server , did the trick for me.

  284. Pete says:

    This helped me in 2015 yet, with SQL Server version 2014.  To say it again, great post!

  285. Renga says:

    I am having this SQL Error 26 problem in a Win 7 64 bit machine where I had installed LocalDB  version of 2014. I get this error after I start the app and try to connect to the database. I tried to start the server in services.msc screen but there is no SQL server services itself is seen running there !  Can anyone give me how to resolve this Error 26 issue for a LocalDB 2014 server. Thanks.

  286. amine says:

    Resolved my problème, I haven't activated the browser service