SQL SERVER – FIX : ERROR : (provider: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server) (Microsoft SQL Server, Error: )

Regular readers of my blog are aware of the fact that I have written about this subject umpteen times earlier, and every time I have spoken about a new issue related to it. Few days ago, I had redone my local home network. I have LAN setup with wireless router connected with my four computers, two mobile devices, one printer and one VOIP solution. I had also formatted my primary computer and clean installed SQL Server 2008 into it. Yesterday, incidentally, I was sitting in my yard trying to connect SQL Server located in home office and suddenly I stumbled upon the following error. Finding the solution was the most infuriating part as it consumed my precious 10 minutes.

Let us look at few of the common errors received:

An error has occurred while establishing a connection to the server.

(provider: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 5)

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

I eventually found the resolution to this error on this blog itself; so I was saved from hunting for the solution. I am sure there are a number of developers who had previously fixed this error while installing SQL Server 2008 or SQL Server 2005 but in due course forgot the right solution to this error. This is just a quick refresher. Make sure to bookmark this as you never know when you would need this solution.

Let us check into the steps to resolve this error.

1) SQL Server should be up and running.

Go to All Programs >> Microsoft SQL Server 2008 >> Configuration Tools >> SQL Server Configuration Manager >> SQL Server Services, and check if SQL Server service status is “Running”.

In addition, ensure that your remote server is in the same network. Run “sqlcmd -L” in your command prompt to ascertain if your server is included in your network list. You can even find tutorial for the same here SQL SERVER – Find All Servers From Local Network – Using sqlcmd – Detect Installed SQL Server on Network.

I have confronted numerous situations when these nerve-wracking errors crop up, and most of the time when I try to troubleshoot I notice that SQL Server services are neither running nor installed. If SQL Server is not installed as default instance SQL Server Browser should be running together with it; we will explore this further in Topic 5.

2) Enable TCP/IP in SQL Server Configuration

When two or more SQL Servers are connected across network they do all communication using TCP/IP. The default port of SQL Server installation is 1433. This port can be changed through SQL Server Configuration Manager. TCP/IP should be enabled for SQL Server to be connected.

Go to All Programs >> Microsoft SQL Server 2008 >> Configuration Tools >> SQL Server Configuration Manager >> Select TCP/IP

Right Click on TCP/IP >> Click on Enable

You must restart SQL Server Services for all the changes to take effect. Right click and go to menu properties to select location where default port of SQL Server can be changed.

3) Open Port in Windows Firewall

Windows Firewall is very efficacious in protecting the Operating system from all sorts of malicious attacks. By default, many of the ports and services are refrained from running by firewall. Time and again, SQL Server ports are not open in firewall as well. All the ports on which SQL Server is running should be added to exception and firewall should filter all the traffic from those ports. As described, by default SQL Server runs on port 1433, but if default port is changed then the new port should be added to exception. If SQL Server has named instance (another instance besides default instance) is installed, SQL Server browser should also be added to the exception, as described in Step 7.

Go to Control Panel >> Windows Firewall >> Change Settings >> Exceptions  >> Add Port

Make the following entries in popup “Add a Port” and click OK.
Name : SQL
Port Number: 1433
Protocol: Select TCP

4) Enable Remote Connection

Enabling remote connection is another important, yet oft-neglected step that is frequently missed by database administrators while setting up SQL Server. If this feature is turned off SQL Server will function smoothly on local machine, but it will let another server connect to it remotely. By default this feature is ON in SQL Server 2008.

Right click on the server node and select Properties.

Go to Left Tab of Connections and check “Allow remote connections to this server”

5) Enable SQL Server Browser Service

If SQL Server is not installed as default instance but instead installed as named instance and also if there is no specific TCP/IP port configured, it will give rise to the error that is being discussed in this article. If SQL Server Browser service is enabled, it will allow the server to be connected through dynamic TCP/IP port. Enabling this service is a one-time process, as on enabling it once it will apply to all the instances installed on the same server.

Go to All Programs >> Microsoft SQL Server 2008 >> Configuration Tools >> SQL Server Configuration Manager >> SQL Server Browser

Right Click on SQL Server Browser >> Click on Enable

6) Create exception of sqlbrowser.exe in Firewall

As elucidated in Step 6, sqlbrowser service needs to be enabled for named instance. Windows Firewall may prevent sqlbrowser.exe to execute. So, it is imperative to add exception for the same in windows firewall.

Search for sqlbrowser.exe on your local drive where SQL Server is installed. Copy the path of the sqlbrowser.exe like C:\Program Files\Microsoft SQL Server\90\Shared\sqlbrowser.exe and create the exception of the file in Firewall, as delineated in Step 3.

7) Recreate Alias

It is getting quite common to create alias of SQL Server and use it in application. This will ensure that in future if any physical SQL Server has to be moved, it will not be required to change any code or connection string. You can simply create alias with the same name pointing to different SQL Server and it will start working instantaneously. I have observed that a couple of times due to internal error while recreating alias this error was fixed.

Go to All Programs >> Microsoft SQL Server 2008 >> Configuration Tools >> SQL Native Client 10.0 Configuration >> Aliases

Delete the alias that is giving problem and recreate it with identical parameters.

I have tried my best to include all the methods of fixing this error and if I have missed any, please leave a comment and I will be very glad to include them here. I have put in my effort to encompass this issue in one article that needs to be refereed when any connection error comes up.

Watch SQL in Sixty Seconds video to Resolve Connection Error:

Reference : Pinal Dave (http://blog.SQLAuthority.com)

About these ads

530 thoughts on “SQL SERVER – FIX : ERROR : (provider: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server) (Microsoft SQL Server, Error: )

  1. Holy Moly.

    Can Microsoft make this any more complicated? Maybe I’m a dreamer, but this configuration-rats-nest is just asking for trouble.

    Oh wait. Oracle makes it harder. Nevermind. I love it.
    Ignore my earlier comment.

    -)

      • Yes, that’s genius advice. Except I build applications for both SQL 2005 and 2008, as well as VS 2005 / 2008, .NET 2.0, 3.5, etc.. bottom line; professionals have sophisticated needs and this is classic ‘fail’.

      • I’m a programmer who’s usually admin-challenged especially when it comes to networks, protocols, ports, and yet I really didn’t have any trouble getting all my SQL servers set up and all accessible from a workstation-hosted copy of Management Studio.

        Now, making sure they are using the strongest security best practices, that’s a topic for another day…

    • hello dave……
      the connection which i am trying works well with other application.. but when i try to store an excel file in to database i get such error…….
      can u please help me…..

    • What I see here is the need to configure the Windows OS on the server, the SQL Server software and the database. Why the complaints about how complicated it is? There is no such thing as a one-size-fits-all implementation, and all these configurations allow admins the flexibility they need to deliver what the client wants. You may want a publicly available database, or an internal network application, or something available only locally on the machine itself. We need software flexible enough to handle all these scenarios and more.

      If deploying databases and building information systems was easy, then the world would not need programmers and systems admins.

    • Thanks, this finally worked for me after many hours of troubleshooting. In the end I had a bunch of aliases to the local machine running SQLEXPRESS, deleted them all and verified that the port in the TCP/IP setting was the same as the one alias: MACHINE\SQLEXPRESS port 1433

  2. Another possible problem I found was to make sure the port listend to was the one expected mine for example had dynamic ports and the IPALL was set to 1066 instead of 1433. From msdn:

    SQL Server 2008 Books Online (April 2009)
    How to: Configure a Server to Listen on a Specific TCP Port (SQL Server Configuration Manager)

    If enabled, the default instance of the SQL Server Database Engine listens on TCP port 1433. Named instances of the Database Engine and SQL Server Compact 3.5 SP1 are configured for dynamic ports. This means they select an available port when the SQL Server service is started. When you are connecting to a named instance through a firewall, configure the Database Engine to listen on a specific port, so that the appropriate port can be opened in the firewall.

    For more information about the default Windows firewall settings, and a description of the TCP ports that affect the Database Engine, Analysis Services, Reporting Services, and Integration Services, see Configuring the Windows Firewall to Allow SQL Server Access.

    To assign a TCP/IP port number to the SQL Server Database Engine
    In SQL Server Configuration Manager, in the console pane, expand SQL Server Network Configuration, expand Protocols for , and then double-click TCP/IP.

    In the TCP/IP Properties dialog box, on the IP Addresses tab, several IP addresses appear in the format IP1, IP2, up to IPAll. One of these is for the IP address of the loopback adapter, 127.0.0.1. Additional IP addresses appear for each IP Address on the computer. Right-click each address, and then click Properties to identify the IP address that you want to configure.

    If the TCP Dynamic Ports dialog box contains 0, indicating the Database Engine is listening on dynamic ports, delete the 0.

    In the IPn Properties area box, in the TCP Port box, type the port number you want this IP address to listen on, and then click OK.

    In the console pane, click SQL Server Services.

    In the details pane, right-click SQL Server () and then click Restart, to stop and restart SQL Server.

    After you have configured SQL Server to listen on a specific port, there are three ways to connect to a specific port with a client application:

    Run the SQL Server Browser service on the server to connect to the Database Engine instance by name.

    Create an alias on the client, specifying the port number.

    Program the client to connect using a custom connection string.

    See Also

  3. Hello,

    Thank you for your article, your blog is a very good source of information for sql server professionals. It is a rather good practice to create alias for servers.

    In my company, we have upgraded a customer application from sql server 2000 to sql server 2008, we created an alias with the same name of the server in order to keep the applications running. One day it just vanished from the alias section in mmc configuration manager.
    Then when I tried to add it again, it exhibits me a screen displaying “WMI Error: The file exists”, with an error code 0x80070050. I can create other alias, but this with the same name I created before, I can’t. I am stuck on this problem.

    I wonder if you have ever faced a similar problem, if you can help me out.

    Thank you!

  4. Oh My God!! your’re the best… you have solve this big problem to me. You’re my new Saint.. Thanks you so much.. I didn’t realise the meaning to sheard solutions… God
    bless you!!

  5. hi,
    my problem is that i have done everything but the error still persists
    error is

    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)

    but when i connect my database through wizard in datalist it works .my connection works properly but with sqlcommand it creates problem. i work on sql2005 and visual studio 2008

    • I have the EXACT same problem…. followed the instructions but still can’t connect yet the import / export wizard will allow me to see the tables from my local machine.
      Have you solved this problem yet?

  6. hi ,
    when i create connection string in web config file everything is working fine.
    dont understand why there is a problem when i create the connection string on .aspx page.
    never mind things r working now.

  7. Thank you, Vince!!!

    I tried everything I could find on this subject with no luck until I read this:

    “To assign a TCP/IP port number to the SQL Server Database Engine
    In SQL Server Configuration Manager, in the console pane, expand SQL Server Network Configuration, expand Protocols for , and then double-click TCP/IP.

    In the TCP/IP Properties dialog box, on the IP Addresses tab, several IP addresses appear in the format IP1, IP2, up to IPAll. One of these is for the IP address of the loopback adapter, 127.0.0.1. Additional IP addresses appear for each IP Address on the computer. Right-click each address, and then click Properties to identify the IP address that you want to configure.

    If the TCP Dynamic Ports dialog box contains 0, indicating the Database Engine is listening on dynamic ports, delete the 0.”

    Once I deleted those zeros and put in 1433 for TCP ports on each IP address, voila!

    Boy what a pain in the arse!

  8. A connection was successfully established with the server, but then an error occurred during the pre-login handshake. 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: Named Pipes Provider, error: 0 – No process is on the other end of the pipe.) (Microsoft SQL Server, Error: 233)

    • Thanks for the obvious! Your comment jogged my meneory and made me realize I was running the release version instead of the debug version of my app. The connection string was only correct in the debug one!

      Back to basics! Think before you click…

      Cheers,

      Paul

  9. I hope you could give me some advise as well regarding my problem. Currently I am working with a Windows Mobile project that will communicate with SQL Server 2005. To connect to my SQL Server my connection is “Data Source=myIPaddress,1433;Initial Catalog=databasename;User ID=sa;Password=sa;”. When I’ve tried to open it in SQL Management Express it is working fine. But when I’ve tried to that setting in my Visual Studio 2008 code, I always get the error “SQLException”. Is there anything that I need to adjust in my Windows Mobile Emulator? I hope you could help me. Thanks and kind regards.

    • followed everything else but this was the last item that fixed my issue, added “,1433″ in the web.config file connection string and problem solved.

  10. Gracias amigo, no tenia idea del error que me estaba dando y con tu explicacion me ayudo a solucionar mi coneccion con el servidor. espero poder contar contigo para cualquier consulta mas adelante, muchas gracias.

  11. So, I installed a clean default setup of SQL 2008 x64 on Windows 7 Ultimate x64, before even opening SQL MC I updated it to SP1.
    Yet, I cannot connect to my Server using SQL MC.
    I get the following error:

    A network-related or instance-specific error…
    Veryfy the instance name and that SQL is allowed remote connections (provider: Named Pipes Provider, Error: 40 – Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 3)

    Things I’ve done:

    Protocols are Enabled (Named Pipes, TCP/IP, etc)
    Disabled Firewall (To get it out of the equation) yet, I added port 1433 TCP just in case

    Rule out Client:
    Tried client Toad freeware version and IT CONNECTS!!!! without a problem, leaving firewall, TCP/IP Named Pipes issues aside.

    Theory:

    SQL Management Console has problems with Windows 7 Ultimate x64 bits.
    I couldn’t find anything on the web that relates to this problems other than the fact that SQL has known compatibility issues with Windows 7, but I thought they were solved after SP1

    Any help would be greatly appreciated

    • HI Ezequiel,

      Your solutions is of immense help to me. I have your suggestions of removing dynamic values of zeros and putting up 1433 in the TCP port and it worked.

      Thanks a lot.

      Hats off to you.

      Regards,

      Sudeep Kar

  12. I followed all the steps, my problem is still in there. Mine may be different in that I have two servers: One application server that has asp.net application pointed to the database server.
    When I run my application from IIS server, I got 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: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server)

    Please help me

    • hi Yoseph….
      I am facing the same problem as mentioned above
      Asp.net application is on one server
      Database is on another server.While trying to make a connection from asp.net application to the database the error is being displayed.
      Is your error resolved?
      If yes, can you help me out.

  13. Hi Pinal,
    There are greate articles in this site.
    I just had a feed back on your Article. where you mentioned
    “You can simply create alias with the same name pointing to different SQL Server and it will start working instantaneously”
    I am not sure if that is correct. I will get error if I want to creat alias with same name.
    In general, seems to me sql alias is kind of “useless” . It
    is tightly coupled with specific server. and if the server
    changes then alias needs an “update” too.

  14. Thank you so much, your post help me a lot configuring sql to allow remote connections. I was having a hard time trying to figure out what was wrong (sql browser wasn’t running).

    Thank you and keep working hard with your blog :D

  15. One more minor issue encountered is when people use sqlexpress.They connect to the server as machine\sqlexpress. So, in the connection string in the code, a “.” or “local” or “machinename” won’t work. it has to be server = “machinename\sqlexpress” otherwise we will get the same error.

    • Punit’s response on November 5, 2009 at 5:31 am resolved my problem guys.

      Í’m using Windows 7, SQL 2005 Express, Visual Studio 2008 and could not get ASP.NET SQL Server Setup Wizard to see the SQL Server instance.

      Please note that i also followed the toher steps in the initial article.

      Enjoy

      • I’ve been trying to install the Sharepoint Designer Training Module on Sharepoint 2007 on various flavors of Windows 2008 server, using the SQL Express setup that falls out of the SharePoint install, and I kept hitting this same Named Pipes 040 error. I finally have gotten past the hurdle after trying all the additional steps suggested in this blog. The key ingredients seem to be:

        1. Make sure the TCP/IP and Named Pipes are enabled in the Protocols section.

        2. Make sure the Server Browser service is enabled; it is set to “Start Mode – disabled” by default.

        3. Use the fully qualified SQL Server name in the “Server Field,” “[SERVER]\OFFICESERVERS” (OFFICESERVERS is the default name for the SQL Express server that automatically comes out of the Sharepoint install).

        • Thanks Forrest!

          Using Visual Studio 2008 with SQL Express 2005.

          Trying to add data connection and getting this error. After reading your third point noticed server name doesn’t include SQL instance, added that and works perfectly.

          Thanks again :)

    • Thanks Punit!

      “machinename\sqlexpress” instead of “machinename” fixed my problem.

      And thanks to Pinal Dave for this great blog.

      Mike

    • I had the same error msg…and intellisence kept complaining about the syntax (invalid escape sequence)…so i used “machinename\\sqlinstance” and it worked…hope this helps someone else…

      • Well, of course. This is basic programming stuff :)

        “foo\bar”

        Here the compiler (or parser to be precise) thinks \ starts an escape sequence. It this case it would interpret \b as backspace. So you need to tell the compiler that what you meant was actually backslash.

        “foo\\bar”

        In C# there’s another way to do it.

        @”foo\bar”

        @ before quatation mark tells that what ever is inside the quatation marks must not be escaped.

  16. Hey,
    I’ve installed win2k8 R2 and MSSQL server 2k8, please be aware that you have to install SP1 to get the whole thing to work :-O

  17. Hi,

    I’m using SQL 2005 Standard Instance.
    When I try to open the SQL Server Management studio it throws the below error.

    ———–
    Cannot connect to .

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

    Solution I have tried:
    a. Start > All Programs > SQL Server 2005 > Configuration Tools > SQL Server Surface Area Configuration
    b. Click on Surface Area Configuration for Services and Connection
    c. Select the instance that is having a problem > Database Engine > Remote Connections
    d. Enable local and remote connections > ‘TCP/IP’ and ‘Named Pipes’.

    Still i get the same error.

    Could anyone help me out on this?

    – Ramesh

    • Hi,

      Add your server IP address & name in C:\WINDOWS\system32\drivers\etc\hosts.

      Note:Open hosts with notepad & below add server IP address & name & save it.

      This works for Me.

  18. hi,i am from china,i am poor in english,last week,i install sql 2008, when i install it ,it report some errors,but it still install success,but i connect the sql server,it report the follow(not same you ):

    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 follow you :
    All Programs >> Microsoft SQL Server 2008 >> Configuration Tools >> SQL Server Configuration Manager >> SQL Server Services, and check if SQL Server service status is “Running”.

    it is can not run

    it said:

    the request filed or the service did not respond in a timely fashion consult then event log or other applicable error log s of deatils

    i wait your apply.i in trouble……….

    can you send me a mail ,thanks

    • Hi, have teh same problem.. accidentaly I enabled the VIA protocol and after tha refresh, the SQL Server Services was stopped.
      With “SQL Server Configuration Manager”, disable then VIA in “Clients protocols” from “SQL NAtive Client” option… Its works for me.

  19. Hi,

    I want to connect to a SQL server 2008 (64 bit)

    running on windows server 2008 from a windows xp professional(32 bit) machine ,which is in the same local area network.While doing that, I’m getting 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) (Microsoft SQL Server, Error: 53)

    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=53&LinkId=20476

    I’ve checked all the settings found in your post.Everything is perfect.I’ve disabled the firewall in both machines.Even then I’m getting the same error.I can see the sql server name in management studio but while connecting I’m getting the above mentioned error.

    Can you please help me in resolving this?

    Thanks in advance

    Jithesh

    • With “SQL Server Configuration Manager”, disable then VIA in “Clients protocols” from “SQL NAtive Client” option… Its works for me.

  20. ok. here’s a weird one. My code works fine in a “Website” created in Visual Studio 2008. I use C# and use LinQ to SQL to do my queries and such. Today I needed to send some emails to some clients so I created a windows app and started building it. As soon as it tries the first query I get the same error that is mentioned above (I found this page by searching on the error).

    I’ve done some experimenting and I’m REALLY confused. on a web page (default.aspx) this code returns the count correctly for people who haven’t received the update email…

    int iTotal = dbClientBase.NoticeAlerts.Count(n => !n.SentDate.HasValue);

    But the exact same line (using the same connect string as the website app) returns the error when I run it from a windows app. In the Server Explorer, however, I can open the table and look at the data in the table.

    I thought it might be an issue from switching to Windows 7, so I popped over to my Vista machine and got the same results. Works fine in a web page, errors in a windows app. I would REALLY appreciate any help or suggestions with this. It’s driving me up the wall!

  21. Hi,

    I can connect through include file in folder1 but can’t connect through other folder2 which is just aside to folder1. I’m using SQL server 2005 and connecting using IP of machine. Folder2 include file giving error “provider: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server”

    Anyone?

    Thanks in advance

  22. Thanks a million! Was trouble-shooting a new install and didn’t realize that the browser service enabled dynamic port option. It was using 1111 instead of 1433 and causing everything to fail horribly. Noticed this issue after reading your article and it fixed my remaining problems immediately.

  23. Thank you, thank you, Punit and Mithun, for the reminder of the need to add /sqlexpress to the servername.

    Pinal, we so appreciate all you do. Since your entry here comes up first for those searching for the error, could you consider revising your entry so that this suggestion is offered there, rather than people having to read through so many comments?

    Secondarily, I would add that since I (as many, I’m sure) was interested only in connecting from Mgt Studio to SQL Server both on the same machine, some of the steps you offered (like firewall settings and enabling the other SQL services) aren’t needed–if we’re not opening the DB to outside access.

    All I really needed to solve things was to add /sqlexpress, either as localhost/sqlexpress or machinename/sqlexspress. That tip, offered near the top, may be all that some need. I even went back and disabled named pipes and tcpip in config mgr, and restarted, and things still worked (running 2008 on Windows 7). That may be very helpful to note as the first thing for users only wanting to access SQL Server locally, as in development.

    Keep up the great work.

  24. Just resolved a connection problem from the client’s odbc configuration by specifying a port number in the server name:

    mySQLServer\myInstance,1433

    This is a strange one, making sure that I could telnet to the server port 1433, I was still not able to connect from the client. An MSDN article indicates that I should try using the above configuration string for the server name and it worked.

    It appears that if one uses a named instance, the native mssql 10.x odbc client no longer assumes the default 1433 sql port for connectivity.

  25. Alternatively,

    The need to specify a default MSSQL port number at the client odbc configuration process indicates an error was made during the installation of the MSSQL 10.x client. To fix this, navigate to the following key in the registry and make sure that the REG_DWORD for the Value key is set to 1433 (the default port). If this key is not present, create one accordingly,

    HKEY_LOCAL_MACHINE\Software\Microsoft\MSSQLServer\Client\SN10.x\tcp\Property1 (also see screeshot).

  26. hello sir,
    i am a newbie with data administration, and i just deployed my first application on a windows server 2008, i actually was working on my local machine as the for the development with sql server 2005 Standard edition as the datbase, to host it on the server i with sql server 2005 Enterprise edition.

    i only backed up the database on my local machine and restored it on the enterprise edition of the sql 2005 on the server and evry thing seemed to be working fyne on the host , but on client systems the the application is giving the error discussed above, i av gone thru all the process on the host server, but all to no avail, please i need help urgently, can anyone help please…..

  27. Hi,

    Tyr to connect using the server ip address with port numner. For example: 11.22.33.44,1433
    If multiple SQL Server instances are running on Server system then verify that SQL Browser service is running. This service dynamically assign port number to different SQL instances.

    Regards,
    Pinal Dave

  28. If you’re running in 64 bits don’t forget to define the SQL Server Alias in Sql Server Configuration Manager for both 32 bit and 64 bit (default) Client Configurations.

    I didn’t have the aliases configured for 32 bits and I was finding it strange that some applications just didn’t use the aliases.

    Maybe Dave would like to add this one to his post… :)

  29. Hi all,
    Thanks for a detailed tutorial. I am an undergrad student. Last year in my web project i had created website successfully, in Web dev express edition and sql server 2005.
    Now i want to connect Vc++ and Visual studio 2008 and sql server 2005. I have followed all above steps.
    I am doing nothing different but there is no effect what ever i do.

    The same above mentioned error 40 always appear.

    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)

    I am initiating a sql connection on a button click in windows form application(project type).
    My connection string is

    Data Source=USER\SQLEXPRESS2;Initial Catalog=ourImage;Persist Security Info=True;User ID=sa;Password=1″

    This connection string works fine in server explorer. Can any one help me how to communicate with sql server 2005 in vc++ VS 2008.

    Thanks

  30. Hi

    I’m new to this blog and found this blog to be useful.

    I’m experiencing a problem with the installation of SQL Native Client 10.0. Hope someone could help me by providing a solution. Please find below the context and problem.

    —–
    My machine is running on Windows XP Professional SP3.

    I am trying install a CA product, for which SQL server is a pre-requisite. I’ve installed SQL server and the services are all up and running. Furthermore, the CA installation tool is also able to successfully connect to SQL server.

    At the penultimate step of the installation process, the CA installation tool is throwing up an error saying– “SQL Native Client seems to be not installed”.
    —–

    How do I ensure that SQL Native Client is installed? I understand that there are 3 different SQL Server Native Client files (sqlncli10.dll, sqlnclir10.rll, and s10ch_sqlncli.chm) to be found in the ./system32 folder. However, I can only find sqlncli.10.dll there. Does this indicate any potential issues.

    Any suggestions and/or help are positively welcomed.

    Many thanks.

  31. I ran into this problem this evening, and my fix was not one that is listed here.

    The SQL Server Service was running with the “LocalSystem” credentials, which does NOT permit the proper network access for all remote clients to access the SQL Server. Make sure that the proper credentials are set to run this service for network access, as “LocalSystem” is the most restrictive.

  32. I would add to this GREAT how-to-article.

    Firewall and Dynamic Ports (especially on NamedInstances which default to Dynamic Ports I believe).

    Here is a tidbit I found which finally got me over the hump:
    http://msdn.microsoft.com/en-us/library/cc646023.aspx#BKMK_dynamic_ports

    I’m gonna paste the information in case the URL changes (which MS has been known to do)

    Dynamic Ports

    By default, named instances (including SQL Server Express) use dynamic ports. That means that every time that the Database Engine starts, it identifies an available port and uses that port number. If the named instance is the only instance of the Database Engine installed, it will probably use TCP port 1433. If other instances of the Database Engine are installed, it will probably use a different TCP port. Because the port selected might change every time that the Database Engine is started, it is difficult to configure the firewall to enable access to the correct port number. Therefore, if a firewall is used, we recommend reconfiguring the Database Engine to use the same port number every time. This is called a fixed port or a static port. For more information, see Configuring a Fixed Port.

    An alternative to configuring a named instance to listen on a fixed port is to create an exception in the firewall for a SQL Server program such as sqlservr.exe (for the Database Engine). This can be convenient, but the port number will not appear in the Local Port column of the Inbound Rules page when you are using the Windows Firewall with Advanced Security MMC snap-in. This can make it more difficult to audit which ports are open. Another consideration is that a service pack or cumulative update can change the path to the SQL Server executable which will invalidate the firewall rule.

  33. hi,

    I have the same problem…. I can access to database via:

    <add key="ConnString" value="Data Source=…

    but for extra connections I have to add:

    <add name="ConnectionString" connectionString="….

    I have this error. I used all your solutions! no luck!
    please help me. I did not have this error on xp. I have it on VISTA..!!!!

  34. My problem is Protocols for MSSQLSERVER is missing in configuration manager after instaling Sql Server 2005 on windows 2003 server.
    I can see sqlexpress and sql server browser.

    How can I get MSSQLSERVER under Configuration Manager? Do I have to reinstall?

  35. Thx for the information but I am still having a problem. I am unable to connect to my local instance. when I followed the steps as mention above, I dont c my SQL Server service running…how can I start it manually ? I even turned off my firewall. please help

  36. Hello,

    Thank you, Panal for a great solution.

    However, in my case, it is a little bit more compliated and I just solve it. So I would like to share this infomration too.

    Firs of all, if having two projects in a single solution make sure to change the connection string in both places. in my case web.config and app. config.

    Moreover, anyone using LINQ to SQL make sure that after changing app.config trying to open the setting.setting so that the change takes affect. I was struckled for a while until figure it out that the connection string in setting did not get changed.

    hope this my be a value to someone.

    Cheers,
    Peng

    • My problem was web.config as well. I needed to make sure the connection string was correct, and it slipped my mind until someone reminded me.

  37. This also happened to me when creating a Asp.net website. I forgot that I had changed my computer name, and did not make the proper changes to my web.config file.

  38. Hello

    This is a potential fix for the various people who are receiving 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: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server)”

    I was receiving this error from SQL Server Management Studio after installing SQL Server 2008 Standard taking all defaults and having set the sa password as part of the install.

    The fix was to browse out to the server where I found that the database server had a different name than the one SQL Server was attempting to log into… once I changed it I could login with no problem.

    NOTE: The computer name had been changed for this server and therefore SQL Server Management Studio was looking for MSSQL 2008 on the wrong server name.

  39. Hi, I had the same error, I specified the TCP Port to 1433 in
    SQL Server Configuration Manager->SQL Server Network Configuration-> TCP-IP -> Properties ->Ip Addresses ->TCP Port and this Connection String:

    Regards!!

  40. Hi,

    Is there a way to disable SQL Server to listen on 127.0.0.1?
    I don’t want to allow connections from local host.

    I’m looking for a solution for SQL Server 2000, 2005 and 2008.

    Thanks a lot,
    Uri

    • SQL server Manager -> Client Protocols (32bit)
      or
      SQL server Manager ->Protocols for MSSQLSERVER if its (64bit)

      Double click tcp/Ip and click “IP Address” Tab
      You should see adapters from IP1 to ALL
      If you have IPv6 Enable on your Network adapter you will see a bunch of IPs in that version also, but typicaly you can see the local host loop back in there.

      IP3
      127.0.0.1
      etc..
      etc…

  41. hi,
    i m working with replication in sql server 2005.
    i need to create local subcriber having publisher created on my webserver. But using the wizard i cann’t set the IP address or alias name to access the publisher.But with name instance i.e. remote sql server name, it gives the same error. On network database tab, it only displays the database in LAN. I followed all the stages u told. But the problem remains same. Please help me out.. Same problem i m getting when i m trying to log on to remote sql server (on webserver) by name instance.

  42. Hi, please understand my english grammar. By the way I used to read and checked online our local news without problems, i guess i deleted something or whatever that caused me the error. To be honest i dont know about computers i have no knowledge at all, and i dont understand any of this…now when i open our local news online and check whats in there, it says

    500 Internal Server Error, Apache/1.3.41 Server at [Removed server address] Port 80

    Can i still fix it? Please help me.

  43. Anyone find a fix for the Issue where SQL can NOT accept connections on a private Network?

    Server 2008 RC 2 – SQL 2008
    TCP/IP is Enables
    VIA = Off
    Pipes = Off
    Shared Memory = Off/On (not connecting from same server)
    Dynamic Port is off
    Static Port 1433 is set for 127.0.x.x. and 192.168.100.x
    Remote is enabled

    Web server CAN telnet to my FTP (FTP is on Database Server)
    Web server CAN NOT Telnet to 1433, in under 2 min, it does connect but its SLOW.

    Anyone come across this?

  44. Thanks for the wonderful tutorial! I am wondering, I have windows server 2003 on my VM. However when I type “sqlcmd -L” it gives me an empty server list. It doesn’t even list itself as a server that’s running and I know it should.

    This is a problem b/c on my local machine, I am trying to use Visual Studio 2008 to connect to my VM server, but Visual Studio 2008 doesn’t even see it. I suspect that it has to do with the fact that the server itself isn’t even listed in the cmd prompt on the virtual machine when I type “sqlcmd -L”.

    Any tips?

    Thanks so much,

    Morgan

  45. I’ve figured it out. My internet was working in the first place so be sure to go to Settings on your VPC and change it to the appropriate network adapter.

    ping your VPC to make sure your local machine can see it.

    Also, I was using windows authentication instead of sql authentication which was a mistake. :P

    Thanks for the article, much appreciated. I learned a lot.

    Cheers,

    Morgan

  46. It’s the little things that P$%$ me off. New SQL 2008 installed on the same server as the application was experiencing the same error message for sa login.

    Firewall was on, which kept me from seeing another message that sa was disabled.

  47. This is one that really helps with my case (SQL Server 2008 SP1 on XP x64).
    I verified all the steps that I did, and compare with the above steps, and figure out my problem – the tcpip protocol is OFF!
    Thanks

  48. Good points raised here. I am grateful to you for that, however you deserve more thanks than that. I suffer from color blindness (deuteranopia in my case). I mainly use Opera browser (no idea if that changes anything), and a considerabland a number of web sites are challenging to comprehend thanks to a careless range of colours used. However, here, as the range of colors is good, the design is extremely tidy and pleasant to comprehend. I don’t know whether it was a premeditated and conscious undertaking, or just the ‘luck of the draw’, but I still thank you.

    • Had the same problem today and wasn’t fixed by the above suggestions. My solution maybe worth adding into main text of this blog? Anyway in my connection strings, or when connecting to another server I use the server names not the ip addresses. Somehow the ip to comp name mappings were lost on my network (?) and was therefore getting this error message. The fix was to modify the hosts file and manually specify this mapping.

      The hosts file can be found here:
      C:\Windows\System32\drivers\etc

      with windows 7/vista you will need to first remove the read-only attribute on the file (right click file – properties). Open the file with administrator privileges (right click notepad – run as administrator then navigate to file: C:\Windows\System32\drivers\etc\hosts)

      then add mappings i.e.,

      192.168.0.176 SQLSERVERCOMPNAME

      hey presto, connection allowed!

      I am sure a networking guru can explain why my mappings suddenly dissapeared? Strangely coincides with a windows update!?

  49. Hi, I solved the problem – actually SQL Server Express has to set up locally
    Programs->Microsoft SQL Server 2005->Configuration Tools->SQL Server Configuration Manager
    SQL Server 2005 Services then SQL Server Express properties on log on tab Buil-in account has to be “Local System”. Then test your page it will work.

    bye
    Bambabu

  50. Hi,
    I am learning Reporting Services and I downloaded the AdventureWorks Sample database and installed then on the server. I deplyed the solution and when I try out the Reports, I get the following error (for all reports):
    An error occurred during client rendering.
    An error has occurred during report processing.
    Cannot create a connection to data source ‘AdventureWorks2008′.
    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)

    Please help me so that I can overcome this problem. I have tried all your above steps and still it’s not working.. Your help is really appreciated.
    Note: The comment from Vince talks about the TCP/IP ports and he said that we have to change it to 1433, I am a bit confused which port has to be changed, either the loopback adapter or the machine ip. Please clarify.

    Your quick response is very much appreciated..

    -TK

  51. Hi

    i am not able to connect to sql 2000 remotely in win 2003 server. I am using vwd 2008 express in xp sp2. I configured everything mentioned in the above postings. Plz help. Error is like —

    –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)—I am a new be. Plz hel.

  52. Hi Pinal,

    This is one of the site which gets listed 70% of the times when you do a search for specific problem in SQL Server. Thanks for all the knowledge share.

    Regards,
    Phani.

  53. HALLELUJAH!!! I struggled with this off and on for months before finding these awesome directions. Step-by-step and it worked the first try.

    THANK YOU!!!!

  54. Many thanks to Pinal and Eric!

    I had installed Visual Studio 2010 and SqlServer 2008 R2 on to a Windows 7 machine. Management Studio 2008 could connect, but some apps could not (e.g. aspnet_regsql).

    My problems were solved by combination of running through Pinal’s check list, AND as inspired by Eric’s post, changing the credentials of the SQL Server Browser Service to be NETWORK SERVICE (rather than LOCAL SERVICE)

    I did not run across this problem on a similar setup under Windows Server 2010.

    Regards,

    Art

  55. @Vince: Thank you, sir. After 5 hours of running down all the official MS advice and coming up with nothing, it turned out to be IPAll was set for dynamic ports. After setting it to listen on 1433, all is well.

    I only wish I’d gone to the blogs earlier.

  56. Thanks

    This worked for me

    “To assign a TCP/IP port number to the SQL Server Database Engine
    In SQL Server Configuration Manager, in the console pane, expand SQL Server Network Configuration, expand Protocols for , and then double-click TCP/IP.

    In the TCP/IP Properties dialog box, on the IP Addresses tab, several IP addresses appear in the format IP1, IP2, up to IPAll. One of these is for the IP address of the loopback adapter, 127.0.0.1. Additional IP addresses appear for each IP Address on the computer. Right-click each address, and then click Properties to identify the IP address that you want to configure.

    If the TCP Dynamic Ports dialog box contains 0, indicating the Database Engine is listening on dynamic ports, delete the 0.”

  57. Thanks a lot! I solved the problem and I can make a practice while watch Sudafrica 2010 at home =D
    my SQL Server Browser was not running and I had to start it!!

  58. Also worth checking is that you have enabled both SQL Server and Windows Authentication.

    A daft one that got me for about 4 hours !

  59. Dave,

    You’re blogging on SQL Server is great. This article, like many before it, has really helped me out. Thank you!

    ArizonaRunner

  60. Thanks For Above Setting I done it
    But Currently problem is occurring that Every one on network can access my sql server but i can’t access other servers so if there any clues to setting then please reply

    I am using SQL server 2008 and microsoft server 2008

    Thanks…

  61. Is there anyone who tell me:
    How to connect two systems using sqlserver2005 for the purpose of transfering records from one database to another database….
    Please tell me…..

  62. Hi Pinal,

    I am new to SQL, but using SQL server 2005. What if when i do the command prompt, I get no servers. What do I do please?

  63. Bravo! Very well done sir. Adding the sqlbrowser exception for named instances is what I needed and is what other tutorials had left out. Thank you.

  64. this is quite tricky.

    after i have done the procedures, the connection works only if i specify the IP adrress of the server in the server name.

    if i use the , i got the same error..

    the same happens if i use telnet..

    what seems to be the problem?

  65. *** SOLUTION *** IT WORKED !!!!!

    Just add Comma ( , ) plus Port # in Linked server Name field while adding a linked server. No space in between

    Example: SQLServer,1531

    Note 1531 may NOT the default port for your SQL Server, so check with DBA first.

    I just found that Colon ( : ) does work for port # in SQL server 2005 but comma does.

  66. I am trying to install BCM 2010. It fails. Bottom of log says “Void DetachV1V2Databases(): [BCMHook] SqlException thrown: 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 am not a pro. I checked and have SQL servers 2005 & 2008 on my XP machine (32 bit). On both if i try to run configuration manager i get the message, “Cannot connect to WMI provider. You do not have permission or the server is unreachable. Note that you can only manage SQL Server 2005 and later servers with SQL Server Configuration manager. Invalid class [0x80041010]” I have tried many solutions from internet searches. none work. exceptions on firewall, mofcomp, winmgmt /resyncperf, winmgmt /clearadap, etc. I am lost and need a fix in layman’s terms.

  67. Hi Everyone

    Watch out for the 64bit operating systems!

    If your ASP.net application pool is set to “enable 32bit applications” (under advanced settings) then your SQL Server Alias under SQL Server Configuration Manager must also be setup for the 32bit instance (SQL Native Client 10.0 Configuration 32 bit).

    Your TCP/IP and Named Pipes protocols must also be enabled here.

    I hope this helps.

  68. You forget a very common cause:

    Using normal slash instead of back slash in the connection string.

    localhost/SQLEXPRESS != localhost\SQLEXPRESS

  69. just wanted to help someone out that might be ready to pull their hair out over this error at top of this page and others like it, if you have went through and completed all of the above steps and sifted through other websites but still getting this error, and you have checked, re checked, and checked your installation and settings again and again, get ready, here is the answer for probably 90% of you out there:

    pull up sql server management studio once more, (i know, i know, this time it will work, i promise), in the Server name: field, it probably says SQLEXPRESS, and thats it, but this time type the name of your computer then a backslash in front of sqlexpress, so that it reads something like JOHNDOEPC\SQLEXPRESS, then with everything else filled in appropriately click Connect, and, Voila!

    i do not know why M$ did not make this more apparent for its end users, but they should have, this took me a long time to figure this out for myself after having gone through more than a dozen websites offering remedies none of which worked…

    oh well, enjoy!

  70. Hi,

    This is really great help me to solve the problem when This error occur.

    But I have One More problems that
    Other Network SQL server can access me but i cannot access their server AND I have been Set all the settings that are given above.

    So Please Help me out for this problem

    Thanks You.
    Amit Tank

  71. Problem: A connection was successfully established with the server, but then an error occured during pre-login handshake. 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: Named Pipes Provider, error: 0 – No process is on the other end of the pipe.)

    Solution: By Default SQL Server uses Named Pipes. But if that is not enabled then the Client Utility such as Visual Studio OR SQL Server Management Studio will fail to connect.

    To resolve this follow the steps for configuring SQL Client Configuration Utility correctly

    1) Go to Start-> Run
    2) Type the command -> cliconfg
    3) Go to the Tab ‘General’ and left Nav to Disabled Protocols
    4) Select the ones that are supported mostly TCP/IP and move it to Right Side under Enabled Protocols
    5) Then go to Alias and Select Add
    6) Select TCP/IP under Network Libraries.
    7) Under Server Name put Server IP e.g. 172.21.40.104
    7) Uncheck ‘Dynamically Determine Port’ and supply the port explicitly
    8) Supply the Server Name in the Alias
    9) Apply the changes.
    10) Restart Visual Studio or SQL Server management Studio

    That should solve the problem

  72. Hi Thanks for above post.

    Actually i have tried all solutions above but problem with my case is very strange

    i am trying to connect to our website live database (ms sql 2005 server) but the strange thing is that this is connecting with all other database servers (different servers with different database)

    I am getting problem with only this database server.

    i can even remote desktop this database server but can not connect through management studio.

    Any solution on this would be highly appreciated.

    Regards,

    Qasim Raza

  73. Pinal – you always amaze me with your thoroughness and attention to detail. Exactly what I need, and laid out so simple that even I can understand it, do it and explain it.

    Thanks so much!

  74. Hi,
    Please guide where I am doing wrong:

    My database reside on a separate server and my online website need to access that server to fatch some data. The server is in my office and connected with Internet.

    I have configure the SQL server 2005 on the server to allow remote connections. Enable TCP/IP and named pipeline. The port is 1433. And done everything as stated in this post.

    I have tried following connectionstrings.

    1. add name=”DatabaseConnectionString” connectionString=”Data Source=nt1111;Initial Catalog=testdatabase;Persist Security Info=True;User ID=test;Password=***” providerName=”System.Data.SqlClient”

    2. add name=”DatabaseConnectionString” connectionString=”Data Source=nt1111;Initial Catalog=testdatabase; User ID=test;Password= “***”; User Instance=False” providerName=”System.Data.SqlClient”

    3. The same as 2 but with IP add name=”DatabaseConnectionString” connectionString=”Data Source=999.99.9.99;Initial Catalog=testdatabase; User ID=test;Password= “***”; User Instance=False” providerName=”System.Data.SqlClient”

    But, I get 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: TCP Provider, error: 0 – The requested name is valid, but no data of the requested type was found.)

    Please guide, I have already spent many hours on it :(

    /Danish

  75. on windows server 2008 64 bit version ,i instal 32 bit Sql server 2005,after that i instal 32 bit vs 2008 ,now can i configure vs 32-bit to server 32-bit ,and i didnot found sql instance in the firewall settings ,can anybody help ……me

  76. Hello to all,,,,

    Is there anyone who can tell me how to generate a alert message from sql server2005 whenever i insert a new record in my table…..
    here i m not saying about the error message…..
    Here i m inserting the correct data and my that data is inserted in my table also now after insertion i want a message that one record is inserted in your table in a message box thru sql server….
    but not by vs..

  77. my firewall and networking icon disable sometime after installing sqlserver2008 express on my windowsxp pro sp3.
    Provide a solution to thsi problem.my network icon diaplay after sometime.

  78. Hi pinaldave,
    Your explanation is wonderful for a lame user like me. Please answer my question as I’ve been trying for several days to install MS SQL Server 2008 on windows 7 home premium. I have downloaded the MS SQL Server 2008 & visual studios SP1 from
    http://www.microsoft.com/downloads/details.aspx?FamilyID=08e52ac2-1d62-45f6-9a4a-4b76a8564a2b&displaylang=en

    and installed it on my laptop. I could not connect as I kept receiving the Network error 26.

    I noticed that the instance name and ID is not created after the installation.

    I follwed some instructions on the page and enabled the ports on the firewall.

    The protocol list is empty in the SQl server configuration manager.

    Please guide me from here. Waiting for your answers.

    Regards,
    Nithya

  79. It’s me again..

    I tried to open the SQl server configuration manager again and can now see the protocols listed and the TCP/IP is enabled.

    I cannot find any servers listed in the command prompt. How do I start from here??

    regards,
    Nithya

  80. hello every body

    i did an application with c# to connect to sql server and it worked well on my local machine (to connect to my sql server 2005 on my computer),

    but now i want to connect to a remote sql server 2005 which is on another computer, but it failed to connect through the application and even the sql server management studio express 2005 and i failed to connect through visual studio 2008 servers part.

    oh i went banana, i did every thing here and i did what i found in all posts i read.

    -i made sure that the firewall give authority to my application & sql server to connect without blocking,
    -added the port to the firewall
    -added the /sqlexpress to server string
    -added /sqlexpress,port no to the server string
    -used the connection string the provider gave it to me it’s like
    SqlConnection (.NET):
    Data Source=db_name.db.6236289.hostedresource.com; Initial Catalog=db_name; User ID=user_id; Password=’your password';
    But also it is useless

    -quite sure that my sql server tcp/ip and named pipeare enabled.

    oh nooo, i don’t know what can i do???? please any one help me.

    hint : the only way allowed me to connect to that sql server was the “database publishing wizard” when i tried to script my local db and to put it on the remote server, it worked well and created the tables on the remote server,
    But when i tried to make the oppsite (to script the db that is remotely it failed and i get the same error)
    Error details:
    “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: TCP Provider, error: 0 – No such host is known.) (.Net SqlClient Data Provider)”

  81. again me
    there is something i made now

    i made a web page connect to sql server with the same connection string and it worked when i uploaded to my website,

    But

    locally it doesn’t work, may be that means that the problem in my computer especially that my sql management studio couldn’t connect also to that remote server?!!!,

    HINT : my application is a “windows forms application”

    please please help me, it’s urgently.

  82. I have come across that problem and i spend all day to find obivious thing

    all protocols enables. firewall disabled , can connect locally but not from other machines
    system Windows 2008 + sql express 2008 r2 (all 64Bit)

    solution:
    Make sure that not only TCP/IP is enabled but as well on IP Addresses Tab You must enable specific IP you are using to connect. (somehow by default they were off on x64 system)

    Regards

  83. Thank you for your topic, but I couldn’t follow the solution you showed because I couldn’t modify anything in the firewall. The reason is McAfee Anti virus.
    When I open Windows Firewall I immediatly face a yellow line with the following content: “These settings are being managed by vendor application McAfee Personal Firewall”
    In other words, the firewall is not able to be modified because of McAfee.

    Please can you give me an idea to solve that problem.
    Because I am currently not able to change my Anti virus.

    Thanks

    • Hi YAZAN,
      You could have visited the site of mcafee instead of posting the problem to this blog. Follow these steps and it will solve the problem…
      1. Open MCAFee Security Center
      2. Click on personal firewall plus.
      3. Goto Options
      4. Goto System Services.
      5. Search for the Microsoft SQL Server Port 1433 from the list box and check it if you find it, else just add the TCP IP port.
      And you are done…

  84. I cannot connect to a machine with sql 2000 server from a machine with SQL 2005 server instance i get the 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) (.Net SqlClient Data Provider)”

    • Dear Paul,
      Follow the steps for your problem.
      1. Enable the TCP/IP protocol using the Surface Area Configuration Utility
      2. Make sure the TCP/IP protocol is enabled in the SQL Server Configuration Utility
      3. Make sure the SQL Server browser is started. Note this step is optional. It is possible to set the SQL Server instance to use a fixed IP address – but this is non-standard for named instances
      4. Make sure SQL Server and SQL Server Browser are exempted by the firewall on the server machine. This is done by putting sqlservr.exe and sqlbrowser.exe as an exception in the windows firewall.
      (Note: In order to get things to work. You might need to completely reboot the server machine after making the changes. Just by restarting all the services might not solve the problem.)

      Thanks.

  85. Thanks so much for this post. I was having the same issue when conneting to a named sql server instance, and not the default one.

  86. I got this error when i try to link mssql to mysql…but can’t find any help online..hope u can help me..

    my error:

    Named Pipes Provider: Could not open a connection to SQL Server [3].

    thanks…

  87. Hi All,

    I have tried all above mentioned solutions to fix the error. But still I am getting same error.

    I am using Sql Server 2008 Enterprise Edition(32 Bit).

    Please , let me know what is the problem.

  88. I can connect and view 2008 sqlexpress db from Management studio; I can also connect once from Visual Studio 2005, while developing project; but after one connection, I cannot re-connect and instead get this error. The db is local so not a remote connection issue.

  89. Hi Dave

    I am quite new at SQL Server database administration & T-SQL report building (BI). I have often referrred to your write ups on various points and have found your advice and posts extremely helpful.

    Thank you for sharing your knowledge with the community, it has been a big help!

    Best Regards

  90. I followed your steps and it helped, but I am using newer OS (Windows 7) so the firewall configuration is different. If I turn off firewall, connection works. If I re-enable firewall, connection breaks. I have rules for SQL and SQL Brower. What else do I need?

    Thanks for your post.

  91. I have same error message but the scenario is different.I have a xp machine with sql server 2000.When i connect that db from my client xp machine sql server 2005 it connects but when i try to connect from windows server 2008 with sql server 2005 it give me error message as shown above in article.

  92. Hello ,

    ” OLE DB provider “SQLNCLI” for linked server “xx.xxx.xxx.xxx” returned message “The partner transaction manager has disabled its support for remote/network transactions.”.
    Msg 7391, Level 16, State 2, Procedure reminder, Line 5
    The operation could not be performed because OLE DB provider “SQLNCLI” for linked server “xx.xxx.xxx.xxx” was unable to begin a distributed transaction. ”

    When i was connect local sql server to online sql server .

    Thanks. for advanced.

  93. I have the same problem (error: 40), but in my case my site is hosted on a web server, therefore I cannot change any properties.

    Also some other pages connect to the database perfectly fine.

    my site is running on iis7
    and is using ms sql server 2005
    made in asp.net 3.5

  94. Using Server VMWare 2008R2 64 bit as per the pre-requists for the Team Foundation Server.

    Dave

    1. Team Foundation Server 2010
    2. SQL Server 2008R2
    3. Visual Studio 2008
    4. Visual Studio 2010- Ultimate with a package of Test Professional (Test Manager).

    Site is running on IIS7

    You have given the information for the Vista O/S how about if you installing on the Server 2008R2.

    While using the TFS Configration Wizard getting the following error messages an error messages. Any help in this regards will be highly appreciated.

  95. Thx Sir

    i was suffering this problem many times. That time i just restart server and it works. But now i found the solution.

    Thx a lot

  96. Please help!! I cannot get SQL Server Agent (SQLEXPRESS) to run in the Server Config Manager (error: the request is not supported. [0x80070032]) when trying to enable. SQL Server 2008 R2.

    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)

    Is this because my machine itself is inaccessible, or SQL server is configured so that it doesn’t allow remote connections.

    I have completed all your recommendid steps from your blog but SQL Server Agent (SQLEXPRESS) remains disabled (if this is the problem).

    I can successfully add a new data source and link the Tables to DataGridView in Visual Studio C#, but when I compile any project with SQL Compact 3.5 Table (.sdf) or SQLEXPRESS the error appears, also when executing an .exe project with same database.
    metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlServerCe.3.5;provider connection string=”Data Source=C:\GERHARD\ITTC\SQL\MyDatabase#1.sdf”
    Data Source=C:\GERHARD\ITTC\SQL\MyDatabase#1.sdf

    :-( I have tried everything, and have spent hours on this….please help.

  97. Hi Admin or all peoples,

    please help me to get out of this problem…

    coz my problem is not solved yet. i m getting same problem in my sql server.. how can i add port in window firewall…

    i m using window 7 in my laptop.

    plz help me..

    Thanks
    Ashwani Kumar

  98. Hi Admin,

    please help me to get out of this problem…

    coz my problem is not solved yet. i m getting same problem in my sql server.. how can i add port in window firewall…

    i m using window 7 in my laptop.

    plz help me..

    Thanks

  99. Just wanted to say a very big thank you to Dave and everyone who added such useful comments. I would like to echo charlie arehart because my mistake today was such a simple one yet caused me to waste a full hour.

    For adminstrative reasons at my office, I changed the name of my computer and forgot about the change when logging on to SQL Server 2008 with the management studio. I just take the login details for granted and so didn’t notice that, of course, the server name had to be:

    NEW_COMPUTER_NAME\SQLEXPRESS

    Your article and all the comments were great because they really forced me to get more familiar with the various configuration tools, but it might help someone (admittedly they need to be as dumb as me!) who has recently changed something crucial like their computer name to see such a simple solution nearer the top of the article.

  100. Hello everybody,
    I am unable to make an external connection to our SQL server, and the error I am getting is in essence Named Pipes Provider, error: 40 & MS SQ Server, Error: 53.

    We have read through your articels but could not find any help, i.e. external and not only local access is enabled, server is running, VIA is disabled, SQL through Windows Firewall is allowed, and port 1433 is also given access.

    Hence, what else might be a solution?

    Thanks

  101. when i trying to connect sql server 2008 management studio express I got error message
    “a network related or instance specific error occured a connection to sql server. The server was not found or was not accessible

  102. Hi
    I have problem with sql server 2005
    Pls help me to fix the problem
    I have program Microcat Toyota work with sql Server 2005 put when i run progrem i recive these masseg:-

    Microcat was to validate the security using the microcat Authorisation server (MAS) Enter correct ip address and port number of the mas and click contine .
    contaact your system administrator for these settings

  103. Hi sir,
    lots of thanks to u…
    i’m very happy when i found your site for resolved this error: 40 – Could not open a connection to SQL Server) (Microsoft SQL Server, Error: ).
    Now, i can connect my sql with server very easily. the way u are using to solve this problem is very easy and under stabling to any person. spacialy by picture view & step by step solving problem that is very helpful.

    Thanks & Regards
    Sweta prasad

  104. Awesome man! When I installed SQL 2008 Express locally it set the port to 4881…configuring .NET to Database is a nightmare…thanks again

  105. Hi
    This post is very informative.
    After following all those steps and when tried to start the service, I get the following error.

    “The request failed or the service did not respond in a timely fashion. Consult the event log or other applicable error logs for details.”

  106. Hi

    This is great post. Informative and with instructions easy to follow.

    I got the problem after cloningto a bigger hard drive. No other problems except when I tried remoting to my SQL server. I shouldn’t have had any problems, but this post resolved it.

    Thanks

  107. This is a very good and comprehensive step-by-step.

    Please note the following limits with this topic and your solutions:

    -Note that SSMS must be installed to go into Instance/Properties/Connections. Since I’m not installing SSMS on the client systems, I would like a way to do this via command prompt.

    (Note that I DO install SQL Server Express with npenabled and tcpenabled, but sometimes it is installed with np NOT enabled, and/or tcp NOT enabled??)

    -I think the port for SQL Server Express is NOT 1433. Can you verify that please? On my machine, it is 2301.

  108. Hi there, I am having some problems getting my linked server going. I made all the correct active directory changes on the 2 servers.

    I set up an SPN like so on the one server, I haven’t done anything on the other server.

    C:\Program Files\Support Tools>setspn -A MSSQLSvc/CSBTESTDB:1433 LILYDALE\ServSQ
    L
    Registering ServicePrincipalNames for CN=ServSQL,OU=Service Accounts,OU=Users,OU
    =Lilydale,DC=lilydale,DC=ads
    MSSQLSvc/CSBTESTDB:1433
    Updated object

    and then:

    C:\Program Files\Support Tools>setspn -A MSSQLSvc/dory.lilydale.ads.:1443 LILYDA
    LE\ServSQL
    Registering ServicePrincipalNames for CN=ServSQL,OU=Service Accounts,OU=Users,OU
    =Lilydale,DC=lilydale,DC=ads
    MSSQLSvc/dory.lilydale.ads.:1443
    Updated object

    and then here is the summary:

    C:\Program Files\Support Tools>setspn -L LILYDALE\ServSQL
    Registered ServicePrincipalNames for CN=ServSQL,OU=Service Accounts,OU=Users,OU=
    Lilydale,DC=lilydale,DC=ads:
    MSSQLSvc/dory.lilydale.ads.:1443
    MSSQLSvc/CSBTESTDB:1433
    MSSQLSvc/wpllilycal.lilydale.ads:1433
    MSSQLSvc/CSBTestDB.lilydale.ads:1433
    MSSQLSvc/894R4M1-WIN7-DK.lilydale.ads
    MSSQLSvc/894R4M1-WIN7-DK.lilydale.ads:1433
    MSSQLSvc/KAZOO.lilydale.ads
    MSSQLSvc/KAZOO.lilydale.ads:1433
    MSSQLSvc/VMWCTRSVR01.lilydale.ads:SQLEXPRESS
    MSSQLSvc/Update01.lilydale.ads:1433
    MSSQLSvc/lkknxfh-w7-dk.lilydale.ads:SQL2008
    MSSQLSvc/lkknxfh-w7-dk.lilydale.ads:58064
    MSSQLSvc/SQLSE01.lilydale.ads:51955
    MSSQLSvc/SQLSE01.lilydale.ads:SQL2008
    MSSQLSvc/kcna2hg-xp-dk.lilydale.ads:1433
    MSSQLSvc/kcna2hg-xp-dk.lilydale.ads
    MSSQLSvc/BAMBAM.lilydale.ads:1205
    MSSQLSvc/BAMBAM.lilydale.ads:SQLSERVER2008
    MSSQLSvc/csbtest01.lilydale.ads:1433
    MSSQLSvc/sqltestcsb.lilydale.ads:1433
    MSSQLSvc/sqlcsb01.lilydale.ads:1433
    MSSQLSvc/SQLTEST.lilydale.ads:3178
    MSSQLSvc/L3CMDA9-XP-LP.lilydale.ads:1433

    I set my database to trustworthy, successfully, restarted my instance, and when I run this command I still get NTLM:

    select

    auth_scheme from sys.dm_exec_connections where session_id=@@SPID

    When I run this command:

    SELECT

    * FROM OPENDATASOURCE(‘SQLNCLI’, ‘Data Source=ServerB;Integrated Security=SSPI;’ ).MASTER.dbo.syscolumns

    I get this:

    OLE DB provider “SQLNCLI” for linked server “(null)” returned message “Login timeout expired”.

    OLE DB provider “SQLNCLI” for linked server “(null)” returned message “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.”.

    Msg 53, Level 16, State 1, Line 0

    Named Pipes Provider: Could not open a connection to SQL Server [53].

    I followed all the steps from above and still get the same thing.

    Thanks in advance!

  109. A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 – No process is on the other end of the pipe.) (.Net SqlClient Data Provider)

    Server Name: HARI
    Error Number: 233
    Severity: 20
    State: 0

  110. four computers…sitting in the backyard….precious 10 minutes…you’re trying too hard…why don’t you just drop your act and be yourself. fuckin loser.

  111. Do you know if Windows 2008 SP1 is affecting in some way this configuration. I’m getting this error since I installed SP1 and I have checked all configurations explained here and I’m still having the problem.

    Thanks.

  112. None of the above tricked work and then….

    found following at

    http://serverfault.com/questions/58579/cannot-connect-to-sql-server

    pull up sql server management studio once more, (i know, i know, this time it will work, i promise), in the Server name: field, it probably says SQLEXPRESS, and thats it, but this time type the name of your computer then a backslash in front of sqlexpress, so that it reads something like JOHNDOEPC\SQLEXPRESS, then with everything else filled in appropriately click Connect, and, Voila!

    i do not know why M$ did not make this more apparent for its end users, but they should have, this took me a long time to figure this out for myself after having gone through more than a dozen websites offering remedies none of which worked…

    oh well, enjoy!

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

    gettind this error again and again i have tried all the possible things but still not working.it use to work before

  114. Why would you need to open port 1434 to get sql database traffic? I am using my web browser as a sql browser and have the traffic going through ports 80, 5355, 137, and 138. I am also able to utilize port 22. Its because windows firewall sucks so bad that I am able to do it.

  115. We have a firewall between our Web (Windows 2008 R2/IIS 7.5) and SQL 2008 R2 Server. The SQL server has 2 instances, default (port 1433) and named (port 1435, not dynamic). FW is configured to allow communication between both servers on tcp port 1433 and 1435. Web server can initiate communication. SQL 2008 Management Studio is installed on the Web Server. From the web server, we can connect to both instances of SQL using the Management Studio. However, a SQL alias does not work for either instance. Error code: “A network-related or instance-specific error occurred while establishing a connection to SQL Server. … Error 53.”
    Windows FW is off on both servers. We are using TCP/IP; protocol is enabled on both servers; alias set to use TCP/IP. Alias is using IP of SQL server (not the server name) and for the named instance we use “\” between server name and instance name. From web server, telnet to sql server IP 1433 and 1435 works. Remote connections allowed. Does using a SQL alias require additional ports / other settings?
    Thanks,
    Eileen

  116. Hi pinal,

    I have VPS of window 2008 and have installed sql server 2008 express r2 on it. I got following error many times a day “|80004005|Cannot_open_database__sds__requested_by_the_login._The_login_failed.” in my iis log. i am using classic asp for my website and i generated new db user to connect.

    After getting above error i modified connectionstring in ASP script to connect database using “sa”. after this modification i was getting “|80004005|Shared_Memory_Provider:_Timeout_error”. I was enabled only Shared Memory Protocol.

    After getting above error i was enabled all protocols (Named Pipe and TCP) but still on same. then i disabled Shared Memory Protocol now i’m getting this error. “80004005|Named_Pipes_Provider:_Timeout_error_” as well as “|80004005|Cannot_open_database__sds__requested_by_the_login._The_login_failed.”

    can you please help me to resolve this error.

    Thanks & Regards

  117. I connect SQL server 2008 with Microsoft SQL server Management studio it was connect with using database engine server authentication it was connect. I was use this database connection in local site it was working perfect but when we use this same site online it was some time database connected and sometime not connected.
    Please help me to solve this problem..

  118. Hi,

    I am working on windows service (Vb.net), service get started at machine start up. But SQLserver takes some time to start. My services using SQL server connections and failed at start up. After some time it is working fine.

    I used ServiceController for checking SQL server is running or not, but new problem arised …machine is not responsding..

    give ur comments

  119. This post has been very useful, but anyway, doing all that, couldn’t get to a solution.
    The problem was that I had 2 instances, a named one first, a default then. I removed the named one, and could not access to the default by TCP.
    The problem was that, somehow, sql was not listening on port 1433 (even that in the configuration said so, netstat -a made me realise). Never believe in Windows.
    So the solution was change the port to something, restart service, then back to 1433, and restart service again.
    Now it’s working again, after trying all.

    All the best.

  120. hey buddy..

    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)

    the above error has been solved by the first method. i hav followed it and it worked 4 me. However when i acess my database on the server machine it works but when i access it on the client it gives the same error as above.. pleaasssssssssssssssee help me out ASAP.. tired of being tortured by my teacher.. plleeeeeeasse reply asap..

  121. Mr Dave,

    I had errors in trying to make my SQL work too. My problem is that I couldn’t even do step 1 / run my SQL Server (MSSQLSERVER). I get this error: The request failed or the service did not respond in a timely fashion. Consult the event log or other applicable error logs for details.

    need your help. thanks!

  122. This solution worked for me on a fresh Windows Server 2008 R2 x64 + Sql Server 2008 installation:

    netsh advfirewall firewall add rule name=”SQLPort” dir=in act
    ion=allow protocol=TCP localport=1433

    After this I could connect from XP with the SQL Server Management Studio to the database.

  123. I had an issue with connecting to the SQL server on my local machine and after reading the solution at the top of this page I got to the Alias part I didnt delete and replace mine but I did look at the Alias Port and it was blank so I typed in 1433 and YeeeeeeeeeeHaaaaaaaaaa!!!!!

    I’m in! thanx to all on here keep posting to help others..

    Go to All Programs >> Microsoft SQL Server 2008 >> Configuration Tools >> SQL Native Client 10.0 Configuration >> Aliases
    then Right click on the Alias name in right panel select properties and enter 1433 in the Port

    Simplesss when you know how…lol

    Cheers,

    Tex

  124. Thank you much for posting this. Turns out that I could not log in because SQL Server services was not running and I had just started up my computer.

    Thank you once again and I’m surely going to bookmark this.

  125. Great Tutorial,
    just remark as “Vince” says that is important to check each time on TCP/IP protocol -> tab IP address
    if in the sections IP1 /IP2 … IPall the TCP Port is setted to 1433 (default) or containt the right value that you are going to use

    Pulsarstar

  126. Another very common issue people have is when the default port has been changed for the named instance. You must connect to the named instance and define the port ie. SERVERNAME\INSTANCENAME,PORT.

    Happy hunting.

  127. Hi: I also would add case when SQL Server were installed in windows Authentication mode then following steps should applied:

    1. Login with windows authentication.

    2. Right click on the Instance name – Server Properties

    3. Security page

    4. Set the Server Authentication – ‘SQL Server and Windows Authentication mode’

    5. Restart the SQL Service.

    Regards,

  128. Thank you so much..your blogs is really very helpful. Actually i had a trouble in my sql server but to read your blog i find out my solutions..thanks a ton..:)

  129. Hi,

    I have the problem in connecting to my SQL server from godaddy web hosting server. My .net application is hosted in godaddy and the sql server is sitting in my office. When i try to connect my application with sql server out side godaddy, ie from debug mode or hosted in my personal computer , the connection is established and i can query the db. But when i try from godaddy (WWW.projectname.COM) the data base connection is not working. Below is the error msg :

    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: 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.)

    I tried all the available option described in the above blogs but still no luck.. Any help on this…???

    Thanks

  130. Hi,

    I have the problem in connecting to my SQL server from godaddy web hosting server. My .net application is hosted in godaddy and the sql server is sitting in my office. When i try to connect my application with sql server out side godaddy, ie from debug mode or hosted in my personal computer , the connection is established and i can query the db. But when i try from godaddy (WWW.projectname.COM) the data base connection is not working. Below is the error msg :

    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: 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.)

    I tried all the available option described in the above blogs but still no luck.. Any help on this…???

    Thanks

  131. hi..
    I use windows Authentication only to connet sqlsever and my server name is
    OJASWA-24031808\SQLEXPRESS .i use oledb connection and query string is “Provider=SQLOLEDB;
    Data Source=OJASWA-24031808\SQLEXPRESS;Integrated Security=SSPI;Initial Catalog=databasename”.but when i debug website then error occur escape sequence is not recognised.and exception generate connection is not open.plz help me urgent.

  132. I ran the application perfectly and sometimes not work properly(it Shows Error 40 Network pipes..).
    To rectify this, I modify the steps what ever i found in different blogs. these are time consuming………………..
    OMG! I loss my hair till now i didn’t get the result. watz the problem.
    At-last i Found a result in another way, try this http://www. codeproject.com/KB/aspnet/LightIIS.aspx
    And :-))
    If u satisfied or found a result for Error 40 pls mail to me

  133. Greetings

    As always Pinal Dave is my main man, top dogg! I came here and resolved this nagging issue withing seconds.

    Thank you Pinal
    You are the best!

  134. I ran asp.net application through Visual studio 2008 it doesn’t show any error. If i ran asp.net applic on IIS(http://localhost/mywebappname) it shows
    “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: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server) ”
    I have only SQL server 2000 in server2003 and No sql in Client (XP), only visual studio 2008.
    Please tell me whatz my mistake
    Connection string, TCP , firewall settings changed but no result
    Thanks In advance

  135. Dave,

    Please add to your list:

    An additional way to receive the error “provider: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server) (Microsoft SQL Server, Error:” is incorrect spelling name of the server you aretrying to connect to. I know this sounds trivial but it does produce the same error.

  136. Hi, Please can anyone help me as I have problem connecting a cube from Microsoft visual studio 2008 to database engine.

  137. Hi all, we were getting a “TCP/IP Error 0:…sql server not found or host failed to respond…” and the only way to resolve it finally was to add sqlservr.exe to the server firewall from the path of the instance we were connecting to (its in the shared folder for that instance name). We spent hours trying other things suggested above but this is the one fix that finally allowed the client desktop to connect to the SQL server names instance (without having to add port explicitly to the connection string). Plus we didn’t have to make any changes to the desktop firewall. Just hope this helps others…

  138. Many thanks for this great article, this sort of checklist saved my day. Although it must be said that microsoft didn’t exactly make this intuitive for inexperienced users..

  139. Azure Named Pipes Problem

    Got a similiar question for you, but for a very specific circumstance, most likely one to be seen more and more.
    I have two SQL Azure databases, Production (Prod) and Backup (Bkup), and a Network SQL server we shall call Onsite.
    I am configuring a backup strategy for my azure databases, and ultimately I am going to use sqlcmd.exe to execute a sql script file on Bkup that connects to master database and runs
    DROP DATABASE DB1
    GO
    CREATE DATABASE DB1 AS COPY OF Prod.DB1
    GO
    I know the script works.
    The problem I have is I get the:
    “Named Pipes Provider: Could not open a connection to SQL Server [53]. Sqlcmd: Error: Microsoft SQL Server Native CLient 10.0…” when executing the Sqlcmd.exe
    So this complicates things because both servers are Azure databases so I can’t configure any of the standard options you list above, other than making sure my firewall ports are open on the machine I am running the Sqlcmd.exe from, which they are.
    Eventually I will have a second script that does the same thing from the Onsite server copying from the Bkup server which will allow standard maintenance plans to work against the SQL server on our network.
    Any help would be appreciated.
    Thanks,
    Chris

  140. Hi,

    I am facing the follwing error because of the
    ConnectionClass con=new ConnectionClass();
    con.open(“Datasource=”….”,Provider=msolap;,domainname\\username,password”);

    Errror: Provider could not set DATASOURCE, USERID, or PASSWORD property

    please sen me ur answer to [email removed]

  141. Hi there Pinal – we’re facing a very peculiar problem in our organization – we’re running a locally customized ERP with SQL Server 2008 as the remote database running on Windows 2008 R2 with a sonicwall firewall between the server and LAN connections – Remote connections hitting our static IP work perfectly fine but connections over LAN using the LAN IP of the server keep getting login timeout errors and runtime errors.

    We’ve checked our local network to be clean of any trojans and broadcast issues – is there any SQL setting that we’re missing out on? The firewall is correctly configured with 1433 open.

    Any comments?

    Thanks – great blog posts!

  142. Thanks, this post was helpful. The only issue i had was that the sql browser service was disabled, which is weird ’cause that’s the way it is on the actual server. I only had to enable on my testing environment =S.

    Thanks a lot!

  143. Hi Dear Pinal,
    Must thank you for the wonderful steps. I installed sql server on windows 7 for the first time. and was getting the ’40’ error. and luckily the first page i opened was of yours. Immensely loved the steps, easy and in few minutes my sql server was up and running. :) cheers!

  144. Hello Sir,

    while installing SQL Server 2008 in my system i got following error:

    Hello Sir, While installing SQL Server 2008 in my system … i got following error..

    Description:
    SQL Server 2008 Setup has encountered an error.

    Problem signature:
    Problem Event Name: SQL100Exception
    Problem Signature 01: SQL2008@RTM@
    Problem Signature 02: 0x2AECB151
    Problem Signature 03: 0x2AECB151
    Problem Signature 04: 0xC24842DB
    Problem Signature 05: 0xC24842DB
    Problem Signature 06: LandingPage
    Problem Signature 07: Unknown
    Problem Signature 08: Unknown
    Problem Signature 09: Unknown
    Problem Signature 10: Unknown
    OS Version: 6.1.7600.2.0.0.256.1
    Locale ID: 1033

    Additional information about the problem:
    LCID: 1033

    Please Help…..

  145. Hi all,
    We’ve tried everything from top to bottom of this post – tried nearly every single reply and link!!
    And still no joy.
    We have changed so many things so many times it’s ridiculous. I just don’t know where to go from here and we have to get this application published.
    We have and ASP app on our web server that cannot connect to our SQL server
    Made sure remote connections enabled.
    Checked ports on connection manager.
    Added exceptions in the firewalls of the SQL server (Win2k8r2 SQL 2008r2 Ent.) and the Web server (IIS7 Win2k8r3) for all ports, services and applications too.
    Portqueries from any machine on the network show TCP and UDP ports 1433-1434 listening.
    Tried with and without ‘alias’ no joy.
    Tried with firewall off – no joy.
    Added port to connectionString with comma and without no joy.
    Here is our connection string now:

    blanked our password but it’s really there.
    We have been looking at posts for two weeks on this issue and are still stumped.

    Here is the error we still get.

    Server Error in ‘/’ Application.
    ——————————————————————————–

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

    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): 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)]
    System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +6351856
    System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +412
    System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity) +6366442
    System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, SqlConnection owningObject) +180
    System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout) +6366814
    System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +6366729
    System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +352
    System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +831
    System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +49
    System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +6368534
    System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +78
    System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +2194
    System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +89
    System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +6372046
    System.Data.SqlClient.SqlConnection.Open() +300
    System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +67

    [EntityException: The underlying provider failed on Open.]
    System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +11109774
    System.Data.EntityClient.EntityConnection.Open() +142
    System.Data.Objects.ObjectContext.EnsureConnection() +97
    System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) +66
    System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable.GetEnumerator() +47
    System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source) +220
    System.Linq.Queryable.FirstOrDefault(IQueryable`1 source) +383
    eFortesModel.DAL.CommandExecutor.ExecuteFirstorDefault(ObjectQuery`1 objectQuery, MergeOption mergeOption) +370
    Member_MemberLogin.GetFortesUserInfo(String fortesUserLogin) +202
    System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
    System.Web.UI.Control.LoadRecursive() +71
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3064

    ——————————————————————————–
    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.237

    ANY help would be GREATLY APPRECIATED!

    Thanks to all for all the great information. What a wonderful community.

    • Well after two weeks of wrangling, a call to MS and WAY too much reading it turns out it was the code!!
      There was a coding problem in the dynamic data portion of the application. The application developer modified the connection settings, and now the application works as expected.

  146. Hello the above Exception(provider: Named Pipes Provider, error: 40 – Could not open a …….) occurred due to service pack problem. If you Installed SQL 2000 in your Server 2003. Upgrade with SERVICE PACK 4. Your Application will Execute on remote PC’s Over IIS.
    Thats all…..

  147. Hi there,

    I have got the error message prompt:
    Error: A connection was successfully established with the server, but then an error occurred during the login process. (provider: Named Pipes Provider, error: 0 – No process is on the other end of the pipe.)(.Net SqlClient Data Provider)

    my db servers are in cluster environment and they are running fine until recently got this security agent installed in the db servers which I see this error prompts, and they are running fine again once I shut the security agent off.

    Kindly advice, as the security agent installed is a passive agent which only does monitoring on local db activities.

    thanks,
    Boonlep Chua

  148. GO START -> ALL PROGRAMS -> SQL SERVER 2008/2005/2008 R2
    ->CONFIGURATION TOOLS->
    ->SELECT SQL SERVER CONFIGURATION MANAGER
    ->SELECT SQL SERVER NETWORK CONFIGURATION
    ->SELECT PROTOCOLS FOR MSSQLSERVER(YOUR INSTANT NAME)
    ->IN RIGHT TASK PANEL
    ->MAKE SURE MENTION BELOW:

    DISABLE SHARED MEMORY AND VIA
    ENABLE NAMED PIPE AND TCP/IP

    —-MAKE SAME THING IN
    ->SQL NATIVE CLIENT 10.0(SERVER VERSION) CONFIGURATION – CLIENT PROTOCOLS

    RESTART SQL SERVER(MSSQLSERVER [YOUR INSTANT NAME]) SERVICE

    • Hi Rupendra,

      Thanks for the info, beside was wondering do I need to open/add the port for the security agent installed in the db, as the security appliance is running on port 443 which I do not think it is the cause of the error message prompts when the security agent is switched on.

      Thanks.

  149. Hi, I would really appreciate some help, I seem to be failing at step one here. I have installed SqlServer 2008 on a Windows 2008 Server. The installation seems to go fine. When I go into the server configuration manager everything is running, just like in your screen shot. But when I try to connect using Management Studio I get the Named Pipes error 40. I am not even connecting remotely, I am on the same machine. So I tried running sqlcmd -L and sure enough this must be the problem, because MSSQLServer is not listed. It just lists the name of the computer. So this is my question: why is my server not listed, and how can I fix it. Everything is on one machine. MSSQLServer is definitely installed and running, but why doesn’t it show? I have done the other steps with enabling named pipes and restarted the server. I even added the tcp port to the firewall to the exceptions list (even though I don’t think this is relevant because it is a named pipes error). Maybe the answer is here but I am too thick to get it. I would be very grateful for any help!

  150. First I’d like to thank you for this as it’s helped me setup a lab environment where I had this particular issue when trying to setup a SQL Mirror. During the setup I tested running the sqlcmd -L command and can confirm that if SQL Server Browser service is not running on a server, being the default instance or not, it will not be displayed. The install was a default instance of SQL Server 2008 R2 Enterprise.

    Once the service was started it would show up when running the command.

  151. No need to change this settings and all.Beore i faced same problem while Connecting with SQL Server.Finally i got Solution.Now i’m getting output.So Everyone follow this Technique.

    Simply chek your ConnectionString in Web.Config File.

    Like This———–>

  152. I have a similar problem but different error message and still don’t know what to do.

    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 no open a connection to SQL Server) (Microsoft SQL Server, Error:2)

    What should I do?

  153. I fixed the problem. I researched what you wrote in this article and it worked! I enabled Pipe Viewer in SQL Server Network Config and in Protocols for MSSQLSERVER. I also enabled remote access in Windows Firewall! I runs smooth again. Thanks again!

  154. hi pinal ,,

    m new 2 asp.net so tell me what i should install sql server n server manager r differert ??

    wt i should install to connect visual application with sql server 2008 ??

    plz tell me

  155. i am new to sql n i hv installed SQL server 2005 on my laptop with window 7 OS.
    yesterday it was working fine bt today when i tried to connect it,it shows an error

    TITLE: Connect to Server
    ——————————

    Cannot connect to RONAQ\SQLEXPRESS.

    ——————————
    ADDITIONAL INFORMATION:

    A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 – Error Locating Server/Instance Specified) (Microsoft SQL Server, Error: -1)

    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=-1&LinkId=20476

    plz help mee out of dis problm…

  156. I also got this error after I changed my windows login password (even though I’m connecting using SQL Authentication (not Windows authentication).

    When I changed it back to the original blank password I could connect ok.

  157. In connection beetwen two computer’s (Win7 both) and SQL servers (MS SQL 2005-host and 2008R2 express-guest) i get this error ;

    error 18456 severity 14 state 38

    This procedure with ports and firewall is complete ,why i get this error every time i try to connect SQL state.

    Thanks.

  158. Well, had the same problem when opening visual studio. the solution was VERY SIMPLE.
    1. open visual studio with no project loaded.
    2. open the data connection under the server explorer window.
    3. delete all the SQL servers that you see under data connection.

    Thats it.

  159. If still you cant access the server … add sqlservr.exe , sqlbroswer.exe, and sql server management studio to windows firewall exceptions …best of luck

  160. Sarkaar.. Only your 10 precious mins. But, saved 100s of frustating hours of all. Thanks, although I never stumble upon this one yet. I just like to keep reading your posts.

  161. hi! i’m having a problem when i call .SaveChanges(). I’m using Entity Framework of VS2010. It produces this error openstoreconnectionif(0,0). In my development PC which is XP, it works fine. But after deploying it to windows 7 workstation, this error occured. Will somebody please help me?.. I got stuck for days now. Thanks a lot. =)

  162. I’m sorry I forgot to tell, i’m using SQL Compact Database 3.5 SP2 ENU. I also deployed it to other XP workstations and it works fine. Only to Windows 7 it doesn’t. Thanks.

  163. I changed the user profile credentials to full access but with no luck. It’s just a simple windows form program with local database. I wonder if i’m missing something.. thanks.

  164. Hi You! I also met this case, the error occurred but I do not know how to fix, in my Windows Firewall, Change Settings button does not work, I’m using Win7 Ultimate. Can you tell me please mail address to contact is not easy?

  165. i need a little help,
    and expect you can help me in this topic,
    in c#,
    I need to check that if my application is not connected to SQLEXPRESS then it should connect to MS Sql,
    but only under condition that Sql Express is not available on that machine
    else other steps are to be taken
    I am mainly facing problem to check if SqlExpress is available in machine or not

  166. Hello,

    I have this error:

    An error has occurred while establishing a connection to the server.
    (provider: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 5)
    An error has occurred while establishing a connection to the server.
    1) SQL Server should be up and running. YES
    Go to All Programs >> Microsoft SQL Server 2008 >> Configuration Tools >> SQL Server Configuration Manager >> SQL Server Services, and check if SQL Server service status is “Running”.

    Run “sqlcmd -L” ==> Microsoft Windows [Version 6.0.6002]
    Copyright (c) 2006 Microsoft Corporation. All rights reserved.

    >osql -L

    Servers:
    — NONE —

    >sqlcmd -L

    Servers:

    2) Enable TCP/IP in SQL Server Configuration
    All Programs >> Microsoft SQL Server 2008 >> Configuration Tools >> SQL Server Configuration Manager >> Select TCP/IP
    Yes it is enabled

    3) Open Port in Windows Firewall
    Go to Control Panel >> Windows Firewall >> Change Settings >> Exceptions >> Add Port
    All Firewall are off

    4) Enable Remote Connection
    “Allow remote connections to this server” is checked

    5) Enable SQL Server Browser Service
    All Programs >> Microsoft SQL Server 2008 >> Configuration Tools >> SQL Server Configuration Manager >> SQL Server Browser
    It is enabled

    6) Create exception of sqlbrowser.exe in Firewall
    There is no firewall

    7) Recreate Alias
    All Programs >> Microsoft SQL Server 2008 >> Configuration Tools >> SQL Native Client 10.0 Configuration >> Aliases
    No Alias!!!

    everything looks okay but still not able to access the new RS isnatnace!!!
    Any idea?

    Thanks,
    Dom

  167. @ DOM: Enabling the TCP IP only is not enough. Double click the TCP-IP and change the port number for all to 1433. It wirked for me hope it will work for you too.. Try Plz

  168. hi
    thank you for posting this article.
    i have followed each and every step from the starting point but i can’t delete the Alias folder from the sql server Native client,
    please send me the solution to this problem.

  169. hello pinal dave and madhivana sir

    sir i want to export data sql server to excel file

    i knew that use database right click export or import

    but i have don’t know coding this query

    plz sir send me query to export data and import data

    ok sir happy
    delhi

  170. Hi,

    SQL Server (BKUPEXEC) service is not starting and I am getting error: 1067: THe process terminated unexpectedly.

    Actually, I have Symantec Backup exec installed 12.5 on a client server and because this service is not running, the software doesn’t work. As per system logs error is “SQL Server: Your SQL Server installation is either corrupt or has been tamplered with (Unable to load SQLBOOT.DLL(HRESULT 0x8007007e)). Please uninstall then re-0run setup to correct this problem.

    Can anyone please help me out what could be the problem?

    I have restarted the server but it didn’t help

  171. After folowing all the steps of this article, the problem still persisted.
    Turning off the firewall on the server was the solution for me…

  172. When i connect to SQL server from local system it is connected, But what happen When I connect SQL from other machine in network it not login to the server but showing the following error.
    I tried to fix this problem by changing the setting of firewall but not got the solution.
    Please help me to solve this issue.

    A connection was successfully established with the server, but then an error occurred during the login process. (provider: TCP Provider, error: 0 – The specified network name is no longer available.) (Microsoft SQL Server, Error: 64)

  173. hi what if i encounter this kind of 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: TCP Provider, error: 0 – Only one usage of each socket address (protocol/network address/port) is normally permitted.)

  174. I’m facing the problem while starting the SQL server Agent in SQL Server Configuration Manager of SQL 2008. It is showing that The Remote Procedure calls failed.
    While changing the start mode in its properties can u plz guide me what can i do?

  175. Dear,
    I have same problem i.e. unable to connect server (using win authentication) but as you suggested also can’t work b’coz it doesn’t have option for configuration (i.e. configuration tool) . Is this pb of setup file (43.2 MB) …?

    Error Msg:
    An error has occurred while establishing a connection to the server.

    (provider: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 5)

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

  176. Hello Mr. Dave
    This is the first time i am sending a post to you. But I always follow your advices. your advices helped me lot when no one was near me to suggest.

    today i faced a problem that when i want to connect to sql server 2008 on the windows server 2008 then in the udl file the server name is showing but when i connect through windows authentication or sql authentication then it is giving me an eror as sql server doesnot exist or access is denied.
    but when i tried from other pcs i can connect to the database and my windows application is working fine.
    all the pcs are in the same network and in the same domain also.
    but why then the problem is only for this 1 pc only.
    i checkd all the issues above which you suggested me but also the same problem.
    please guide me.

  177. I followed your steps, but still couldn’t attach. Found elsewhere to check the port number SQLExpress was using. Turns out SQLExpress was using dynamic ports. I forced it to use 1433, and (including all the above instructions), could finally connect. Yeah!

  178. Hi,

    The servers need to have Static IP. Because we tried to connect this server from the outside not in the same network.

    Please advise.
    Regards,
    Mike

  179. You can’t imagine how do you help me at this moment, it’s an extraordinary article, i thank you sooooooooo much, thaaaaaaaaaaaaaaaanx

  180. Mr. Dave – Thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you!

    your fix provided the tip to allow the sqlbrowser.exe thru the firewall. i’ve only been looking for this resolution for…um…a couple of weeks now. Your Fix worked with 2008 R2 & SQL 2012 RC0 – that I was trying to access via Office 2010 Access database front end.

    Happy Holidays

  181. thanks. I was searching for the solution of error 10061 for hours. My mssql server was stopped and works fine after I initiated mssql server. I feel like so dumb now.
    thanks.

  182. Hi sir,
    Sir i have 50 flat files . I want create automatically tables in sql server using SSIS loop or use any statement sir But i want at time to create the table and automatically inserting the data throughout each flat file .
    Finally i want to get massage 50 tables created and related columns and data also

  183. Hi Expert:
    I have install sql server 2005 on microsoft server 2008.and also restored database.

    I have create alias with as “expodb”. And it working fine for me during login in sql server management studio.

    when try to connect the database using server name or alias in c sharp connection string it gives me “sql server error :40 “.

    but when i use .net data source configuration wizard for connection, it shows database by using both server or alias.

    But that connection string when i use in code it gives me above sql server error 40 , native connection….. .

    when enter sqlcmd on command propmt it also gives me same kind of error.
    please note that there is no LAN driver on my system.
    Please help me ,
    Thanks in advance

  184. I have followed the steps demonstrated in this article but I have yet to find where the problem lays with my situation.
    Here is the error I am getting:

    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)

    Perhaps it is addressed here but being a novice with this kind of stuff I haven’t seen it.

    Thank you if you can shine a light on this problem.

  185. hi
    i m using visual stdio 2010.
    when i create new sql server database in vs2010 ,it asks for server name and
    database name (new).it gives an error like “Login failed for user ‘server_name\User’. (Microsoft SQL Server, Error: 18456)”

  186. I was getting neumerous errors after migrating to a new SQL cluster. after about a month of troublshooting, I decided to try to update my network card drivers on the new SQL cluster. this fixed all the SQL errors for me.

  187. hi
    i have the same problem what you are discuss here when i used aspnet_regserv ,and tried many thing to get ride of it ,nothing helped me actually the error was a small mistake from me i used server name as user-pc
    instead of user-pc/SQLEXPRESS
    :)

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

  189. Sorry for my last post i mistaken not the references. if you try using web.config it you using asp.net project. Im also experience with same error when i try to connect my Sql server 2005 standard Edition.

    step 1.
    try to check Sql server if you are using this configuration Servername:192.168..\databaseschema
    username:xxx
    password:xxx

    step 2.
    {Server side sql server Standard Edition}

    locate Sql server Configuration Manager
    – Protocols for mssqlserver
    -TCP/IP ,Enabled
    -Name Pipes, Disabled

    Sql Native Client Configuration
    -TCP/IP , Enabled
    -NamePipes, Enabled

    step 3. Web.config {webservice project}

    ——————————————————————————————-
    { Possible cause of error’s }

    ——————————————————————————————-

    servername configuration server = 192.168.0.8;uid=…etc
    is defferent from server = 192.168..\databaseschema;uid= .. etc

    Correct me if i mistaken. thanks

  190. I just shared my experience on this error while I’m running webservice project.
    on the top is my alternative solution. I hope I can help some developers
    ———————————————————————————————–
    http://localhost:1595/Main/WebServiceTest.asmx?op=ServiceInsertTransact

    at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
    at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
    at System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner, Boolean& failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup)
    at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
    at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
    at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
    at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
    at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
    at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
    at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
    at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
    at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
    at System.Data.SqlClient.SqlConnection.Open()
    —————————————————————————————————

  191. TITLE: Connect to Server
    ——————————

    Cannot connect to DUALCORE\SQLEXPRESS.

    ——————————
    ADDITIONAL INFORMATION:

    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) (Microsoft SQL Server, Error: -1)

    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=-1&LinkId=20476

    ——————————
    BUTTONS:

    OK
    ——————————
    can any buddy tell me what is proble

  192. Hi Pinal,

    I have a strange issue, I have installed SQL 2008 DE in of the cloud machine with a public IP address. I’m able to connect the SQL Data Base with “localhost” as well as machine name but not with IP address. I have enabled the TCP\IP as well as named pipes but no luck. If I disabled shared memory, it won’t connect with machine name or local host, not sure why. Any help on this

  193. got the following error while starting mssql-server service
    “The request failed or the service did not respond in a timely fashion. Consult the event log or other applicable error logs for details.”

  194. You are are a star my TFS installed caused this error followed the steps all good now….thanks a million

  195. hi all
    i am getting error as”TITLE: Connect to Server
    ——————————

    Cannot connect to COMPUTER_1.

    ——————————
    ADDITIONAL INFORMATION:

    An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

    ——————————

    A transport-level error has occurred when receiving results from the server. (provider: Shared Memory Provider, error: 0 – The pipe has been ended.) (Microsoft SQL Server, Error: 109)

    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=109&LinkId=20476

    ——————————
    BUTTONS:

    OK
    ——————————
    ” how to solve this case help me.

  196. Hi,
    I have worked out all the solutiins you have given in SQL express 2005. I am not able to connect remotely to databased placed on SQL server 2005 ( have Live IP address). In connection string i menton the IP address but falies to connect the database.

    Login failed, Preloginjandshake falied, such error are giving.

    Is there any limitation for SQL express 2005 to connect remptely that SQL express in not in Network but giving IP address it can not be connected?

    KIndly guide,

  197. I have the following – Home Network – Setup
    Admin Logon – SQL Server 2005 – Windows 7 (32-bit) – LocalHost.

    Could NOT Log In via Windows Authentication Mode – ERROR 233. So Connected via SSMS as sa, used (Server) Properties, Security, and unwisely reset the Server authentication to Windows Authentication Mode.!

    Well stuck, so…
    Following bits of advice from other web users, I did this:
    (Windows 7:) Start – All Programs-Microsoft SQL Server 2005 – Configuration Tools – SQL Server 2005 Surface Area Configuration – Add New Administrator(2-keys icon 1st of 5 links) – Brings up “SQL Server 2005 User Provisioning Tool for Vista” – OK, OK You’re Windows 7, but this “Vista” tool still works (No Win 7 in SQL 2005 days, right?). At the top of this window, it says “Granting Administrative Rights to Windows Vista User: \”. Using the > arrow icon, select “Member of SQL Server SysAdmin Role on ” from “Available Privileges and > move it to the right-hand pane (“Privileges that will be granted to \”).

    Click OK.

    Now Log on to SSMS again, using Windows Authentication Mode – works for me!

    SQL Server 2005 is THE MOST AWKWARD Microsoft MONKEY, and takes HOURS off your life! Thankyou Microsoft!

  198. You are a life saver, Why is it not mentioned anywhere in this tutorial. Mine had to with disabled TCP/IP. Knowledge is indeed power.

  199. I am getting this error
    “A network-related or instance-specific error occured while establishing 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) (Microsoft SQL Server, Error: 2)”

    I did all was said but I am not even able to log into my local server on my laptop. I have installed the SQL Server 2008 R2 on Windows 7.

  200. 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)

  201. not working
    same error

    a network-related or intance-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, errpr:40 – Could not open a connection to SQL Server)

    plz provid proper solutions

  202. I was getting the same problem for Sql Server authentication mode only.
    Finally I have selected Windows and Sql Server authentication mode from server properties–>Security.

    Thanks

  203. dear sir,

    i faced this error while connecting remote System, wt should i do? plz help me.

    i need read the remote client system data base ( not in LAN)…. If u have connection string example rly me

    System.Data.SqlClient.SqlException was unhandled by user code
    Message=”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.)”
    Source=”.Net SqlClient Data Provider”
    ErrorCode=-2146232060
    Class=20
    LineNumber=0
    Number=10060
    Server=””
    State=0
    StackTrace:
    at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
    at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
    at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject)
    at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)
    at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
    at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
    at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
    at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
    at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
    at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
    at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
    at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
    at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
    at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
    at System.Data.SqlClient.SqlConnection.Open()
    at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
    at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
    at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
    at Default2.LoadGridview() in c:\Documents and Settings\pc\Desktop\Sr\Library\FrmLib1.aspx.cs:line 66
    at Default2.Page_Load(Object sender, EventArgs e) in c:\Documents and Settings\pc\Desktop\Sr\Library\FrmLib1.aspx.cs:line 42
    at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
    at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
    at System.Web.UI.Control.OnLoad(EventArgs e)
    at System.Web.UI.Control.LoadRecursive()
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    InnerException:

    By Regards

    Sarva

  204. My databases professor couldn’t even figure this out. Thanks to your guide here and the post by Vince I finally got it working. Thanks a bunch!

  205. Hi Sir,
    This is my problem..PLz solve this…

    See the end of this message for details on invoking
    just-in-time (JIT) debugging instead of this dialog box.

    ************** Exception Text **************
    Microsoft.SqlServer.Management.RegisteredServers.RegisteredServerException: Unable to read the list of previously registered servers on this system. Re-register your servers in the ‘Registered Servers’ window. —> Microsoft.SqlServer.Management.Sdk.Sfc.SfcSerializationException: Serialization output is invalid. —> System.NullReferenceException: Object reference not set to an instance of an object.
    at Microsoft.SqlServer.Management.Sdk.Sfc.SfcSerializer.Deserialize(XmlReader xmlReader, SfcObjectState state)
    — End of inner exception stack trace —
    at Microsoft.SqlServer.Management.Sdk.Sfc.SfcSerializer.Deserialize(XmlReader xmlReader, SfcObjectState state)
    at Microsoft.SqlServer.Management.RegisteredServers.RegisteredServersStore.InitChildObjects(String file)
    — End of inner exception stack trace —
    at Microsoft.SqlServer.Management.RegisteredServers.RegisteredServersStore.InitChildObjects(String file)
    at Microsoft.SqlServer.Management.RegisteredServers.RegisteredServersStore.InitializeLocalRegisteredServersStore()
    at Microsoft.SqlServer.Management.RegisteredServers.RegisteredServersStore.get_LocalFileStore()
    at Microsoft.SqlServer.Management.UI.ConnectionDlg.ConnectionDialog.OnLoad(EventArgs e)
    at System.Windows.Forms.Form.OnCreateControl()
    at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
    at System.Windows.Forms.Control.CreateControl()
    at System.Windows.Forms.Control.WmShowWindow(Message& m)
    at System.Windows.Forms.Control.WndProc(Message& m)
    at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
    at System.Windows.Forms.ContainerControl.WndProc(Message& m)
    at System.Windows.Forms.Form.WmShowWindow(Message& m)
    at System.Windows.Forms.Form.WndProc(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

    ************** Loaded Assemblies **************
    mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5456 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
    —————————————-
    AppIDPackage
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.1600.22 ((SQL_PreRelease).080709-1414 )
    CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft%20SQL%20Server/100/Tools/Binn/VSShell/Common7/IDE/AppIDPackage.DLL
    —————————————-
    System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5456 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
    —————————————-
    Microsoft.SqlServer.SqlTools.VSIntegration
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.1600.22 ((SQL_PreRelease).080709-1414 )
    CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft%20SQL%20Server/100/Tools/Binn/VSShell/Common7/IDE/Microsoft.SqlServer.SqlTools.VSIntegration.DLL
    —————————————-
    Microsoft.VisualStudio.Shell.Interop
    Assembly Version: 7.1.40304.0
    Win32 Version: 7.10.6071
    CodeBase: file:///C:/Windows/assembly/GAC/Microsoft.VisualStudio.Shell.Interop/7.1.40304.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Shell.Interop.dll
    —————————————-
    Microsoft.VisualStudio.OLE.Interop
    Assembly Version: 7.1.40304.0
    Win32 Version: 7.10.6070
    CodeBase: file:///C:/Windows/assembly/GAC/Microsoft.VisualStudio.OLE.Interop/7.1.40304.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.OLE.Interop.dll
    —————————————-
    System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5456 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
    —————————————-
    System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5458 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
    —————————————-
    SqlWorkbench.Interfaces
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.1600.22 ((SQL_PreRelease).080709-1414 )
    CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft%20SQL%20Server/100/Tools/Binn/VSShell/Common7/IDE/SqlWorkbench.Interfaces.DLL
    —————————————-
    Microsoft.SqlServer.SqlTDiagM
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.1600.22 ((SQL_PreRelease).080709-1414 )
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.SqlServer.SqlTDiagM/10.0.0.0__89845dcd8080cc91/Microsoft.SqlServer.SqlTDiagM.dll
    —————————————-
    Microsoft.SqlServer.Instapi
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.1600.22 ((SQL_PreRelease).080709-1414 )
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.SqlServer.Instapi/10.0.0.0__89845dcd8080cc91/Microsoft.SqlServer.Instapi.dll
    —————————————-
    Microsoft.VisualStudio.Shell
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1826 (QFE.050727-1800)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.Shell/2.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Shell.dll
    —————————————-
    Microsoft.VisualStudio.Shell.Interop.8.0
    Assembly Version: 8.0.0.0
    Win32 Version: 8.0.50727.1826 (QFE.050727-1800)
    CodeBase: file:///C:/Windows/assembly/GAC/Microsoft.VisualStudio.Shell.Interop.8.0/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Shell.Interop.8.0.dll
    —————————————-
    Microsoft.SqlServer.Management.SDK.SqlStudio
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.1600.22 ((SQL_PreRelease).080709-1414 )
    CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft%20SQL%20Server/100/Tools/Binn/VSShell/Common7/IDE/Microsoft.SqlServer.Management.SDK.SqlStudio.DLL
    —————————————-
    SQLEditors
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.1600.22 ((SQL_PreRelease).080709-1414 )
    CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft%20SQL%20Server/100/Tools/Binn/VSShell/Common7/IDE/SQLEditors.DLL
    —————————————-
    Microsoft.VisualStudio.TextManager.Interop
    Assembly Version: 7.1.40304.0
    Win32 Version: 7.10.6070
    CodeBase: file:///C:/Windows/assembly/GAC/Microsoft.VisualStudio.TextManager.Interop/7.1.40304.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.TextManager.Interop.dll
    —————————————-
    SqlMgmt
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.1600.22 ((SQL_PreRelease).080709-1414 )
    CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft%20SQL%20Server/100/Tools/Binn/VSShell/Common7/IDE/SqlMgmt.DLL
    —————————————-
    Microsoft.SqlServer.Management.UserSettings
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.1600.22 ((SQL_PreRelease).080709-1414 )
    CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft%20SQL%20Server/100/Tools/Binn/VSShell/Common7/IDE/Microsoft.SqlServer.Management.UserSettings.DLL
    —————————————-
    EnvDTE
    Assembly Version: 8.0.0.0
    Win32 Version: 8.0.50727.1826 (QFE.050727-1800)
    CodeBase: file:///C:/Windows/assembly/GAC/EnvDTE/8.0.0.0__b03f5f7f11d50a3a/EnvDTE.dll
    —————————————-
    Microsoft.SqlServer.Management.Sdk.Sfc
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.2531.0 ((Katmai_PCU_Main).090329-1045 )
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.SqlServer.Management.Sdk.Sfc/10.0.0.0__89845dcd8080cc91/Microsoft.SqlServer.Management.Sdk.Sfc.dll
    —————————————-
    Microsoft.SqlServer.Management.Reports
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.1600.22 ((SQL_PreRelease).080709-1414 )
    CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft%20SQL%20Server/100/Tools/Binn/VSShell/Common7/IDE/Microsoft.SqlServer.Management.Reports.DLL
    —————————————-
    Microsoft.SqlServer.Management.Controls
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.1600.22 ((SQL_PreRelease).080709-1414 )
    CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft%20SQL%20Server/100/Tools/Binn/VSShell/Common7/IDE/Microsoft.SqlServer.Management.Controls.DLL
    —————————————-
    Microsoft.SqlServer.Management.SqlStudio.Migration
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.1600.22 ((SQL_PreRelease).080709-1414 )
    CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft%20SQL%20Server/100/Tools/Binn/VSShell/Common7/IDE/Microsoft.SqlServer.Management.SqlStudio.Migration.DLL
    —————————————-
    Microsoft.SqlServer.Smo
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.2531.0 ((Katmai_PCU_Main).090329-1045 )
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.SqlServer.Smo/10.0.0.0__89845dcd8080cc91/Microsoft.SqlServer.Smo.dll
    —————————————-
    System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
    —————————————-
    Microsoft.NetEnterpriseServers.ExceptionMessageBox
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.2531.0 ((Katmai_PCU_Main).090329-1045 )
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.NetEnterpriseServers.ExceptionMessageBox/10.0.0.0__89845dcd8080cc91/Microsoft.NetEnterpriseServers.ExceptionMessageBox.dll
    —————————————-
    ObjectExplorer
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.1600.22 ((SQL_PreRelease).080709-1414 )
    CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft%20SQL%20Server/100/Tools/Binn/VSShell/Common7/IDE/ObjectExplorer.DLL
    —————————————-
    Microsoft.VisualStudio
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1826 built by: QFE
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio/2.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.dll
    —————————————-
    System.Drawing.Design
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing.Design/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.Design.dll
    —————————————-
    Microsoft.VisualStudio.Designer.Interfaces
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.573
    CodeBase: file:///C:/Windows/assembly/GAC/Microsoft.VisualStudio.Designer.Interfaces/1.0.5000.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Designer.Interfaces.dll
    —————————————-
    ConnectionDlg
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.1600.22 ((SQL_PreRelease).080709-1414 )
    CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft%20SQL%20Server/100/Tools/Binn/VSShell/Common7/IDE/ConnectionDlg.DLL
    —————————————-
    Accessibility
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
    —————————————-
    Microsoft.SqlServer.RegSvrEnum
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.1600.22 ((SQL_PreRelease).080709-1414 )
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.SqlServer.RegSvrEnum/10.0.0.0__89845dcd8080cc91/Microsoft.SqlServer.RegSvrEnum.dll
    —————————————-
    Microsoft.SqlServer.Management.SqlStudio.Explorer
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.1600.22 ((SQL_PreRelease).080709-1414 )
    CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft%20SQL%20Server/100/Tools/Binn/VSShell/Common7/IDE/Microsoft.SqlServer.Management.SqlStudio.Explorer.DLL
    —————————————-
    System.Design
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Design/2.0.0.0__b03f5f7f11d50a3a/System.Design.dll
    —————————————-
    System.Data
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
    —————————————-
    Microsoft.SqlServer.ConnectionInfo
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.2531.0 ((Katmai_PCU_Main).090329-1045 )
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.SqlServer.ConnectionInfo/10.0.0.0__89845dcd8080cc91/Microsoft.SqlServer.ConnectionInfo.dll
    —————————————-
    Microsoft.SqlServer.Management.RegisteredServers
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.2531.0 ((Katmai_PCU_Main).090329-1045 )
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.SqlServer.Management.RegisteredServers/10.0.0.0__89845dcd8080cc91/Microsoft.SqlServer.Management.RegisteredServers.dll
    —————————————-
    Microsoft.SqlServer.SqlClrProvider
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.1600.22 ((SQL_PreRelease).080709-1414 )
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.SqlServer.SqlClrProvider/10.0.0.0__89845dcd8080cc91/Microsoft.SqlServer.SqlClrProvider.dll
    —————————————-
    System.Configuration
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
    —————————————-
    System.Web
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5456 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_32/System.Web/2.0.0.0__b03f5f7f11d50a3a/System.Web.dll
    —————————————-
    Microsoft.DataWarehouse.SQM
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.1600.22 ((SQL_PreRelease).080709-1414 )
    CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft%20SQL%20Server/100/Tools/Binn/VSShell/Common7/IDE/Microsoft.DataWarehouse.SQM.DLL
    —————————————-
    Microsoft.SqlServer.Sqm
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.1600.22 ((SQL_PreRelease).080709-1414 )
    CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft%20SQL%20Server/100/Tools/Binn/VSShell/Common7/IDE/Microsoft.SqlServer.Sqm.DLL
    —————————————-

    ************** JIT Debugging **************
    To enable just-in-time (JIT) debugging, the .config file for this
    application or computer (machine.config) must have the
    jitDebugging value set in the system.windows.forms section.
    The application must also be compiled with debugging
    enabled.

    For example:

    When JIT debugging is enabled, any unhandled exception
    will be sent to the JIT debugger registered on the computer
    rather than be handled by this dialog box.

  206. Took me 2 days to figure this out but I changed the permissions on sqlbrowser service from network service to the sql service domain account.

  207. HELLO ALL.
    had this problem..decided one day to not let the sun go down if the situation persisted….and finally resolved it…. all it required really (for my case at least ) was to configure windows firewall for database access..as can be seen here.

    http://msdn.microsoft.com/en-us/library/ms175043.aspx ..

    .after that….i got the error……..”cannot generate sspi context” ………….on one of my servers..had to logon using sqlserver authentication..all the other servers connected easy.. hope this helps..

  208. Thanks man, I have looked at a few different blogs and at the link that the error gives you and could not find what I was doing wrong. Thank you for taking your time to make this easy to follow and with pictures.

    I am back up and running and I can finish what I need to in the nick of time.

  209. Hello,
    I uninstalled SQL server 2008 on my Win 2008R2 machine and tried afresh but during installation process it shows following error

    The following error has occurred:

    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: TCP Provider, error: 0 – No connection could be made because the target machine actively refused it.)

    Click ‘Retry’ to retry the failed action, or click ‘Cancel’ to cancel this action and continue setup.

    Please help!

  210. For me, creating a 32 bit version of the alias did the trick. I guess the installer is 32 bit. Pinal could you emphasize this somewhere in your post? It’s in a few comments but would be helpful to have up top. Thanks for all you do, I always seem to find answers in your blog.

  211. Hello,
    Actually, when my clients are using their websites and when they click on the link which is connected to their database then they are getting 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: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server)”

    How can i fix it at my end. I am using IIS server with sql server 2008

    All sql service is running and TCP/IP is also enable.
    Firewall is aslo off.

  212. In my case, a new SharePoint 2010 deployment will throw the “Named Pipes Error: 40″. Turned out that the firewall was configured wrongly and it wouldn’t all the traffic to get through the SQL Port. I just turned the firewall “on” and SharePoint came up right away.

    I picked up the idea of checking the firewall from your article.

    Thanks
    Nasser.

  213. Thanks vince and coldcold changing tcp port to 1433 and dynamic port to null really worked for me.

    Hi pinal sir , can you please give us more info on this.

  214. Hello there. I’ve read through this article for help with the same error. However, I have Norton 360 that governs all my Windows Firewall settings. I cannot see any ‘services’ in Step 1 above. Could it be Norton that is blocking the service? If so, any idea how to fix this?

  215. sir
    i am getting an error while connecting to database engine
    as:-
    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 – No connection could be made because the target machine actively refused it.) (Microsoft SQL Server, Error: 10061)

    please sir help me out
    regards

  216. Hi thank for guidance
    I am not able to enable SQL Server Browser. if i right click to SQL Server Browser i find only properties. There is no option to enable Sql server browser.
    can anybody help me.

  217. Try setting the Startup type property to Automatic.

    Open Task Manager and select the Services Tab.
    At lower right click on Services… button.
    In the Services dialog find the Name “SQL Server Browser” and right click and select Properties command.
    Set the Startup type property to Automatic and try to start…

  218. hello sir i am got error 53 when i am trying to connect sqlserver2008 mg studio to my web-server using IP add and username & password. i have created DATABASE ,DB USER then also it;s give me the Error, i Hope i got best reply from you..waiting for your Valuable reply…

  219. I execute the above 10 steps , still that i got error when i run the website “Startup Error: Unable to connect to the Database. Exception Message: 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) (-1)” and when i visit the url and test database connection the error comes “Failed to connect: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)”

    What is the problem ? Please help me ? provide me the solution ?

  220. Pingback: SQL SERVER – Resolving SQL Server Connection Errors – SQL in Sixty Seconds #030 – Video « SQL Server Journey with SQL Authority

  221. I can connect the remote database from the SQL Server Management Studio Express without any issues. BUt when I debug my project from VS 2005, the same remote database, it shows 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: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server)”. Can you please help me for the solution ? Thanks in advance.

  222. Dear Friend, thank you very much for this nice and complete tutorial, but nothing works on my sql server 2012 + windows server 2012, until I reinstalled SQL Server and checked during installation option about ability in logging in two ways – SQL and Windows auth. It looks like Windows Auth is default, and SQL auth may be turned on only if we installed this feature.

  223. Attractive section of content. I just stumbled upon your blog and in accession
    capital to assert that I get actually enjoyed account your blog posts.
    Anyway I’ll be subscribing to your feeds and even I achievement you access consistently rapidly.

  224. I believe registry tweaks may be needed when connecting a large number of clients to a single server – we have run into this problem with about 1500 connections from the same client (bug in .net 4.5).

  225. what is this- 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)

  226. i have deployed a web application on server but there is a runtime error i.e. 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)

    i have checked the connection string and database connectivity, but still these error occure.
    so what should i do for resolve these error
    please give me some solution as soon as posible,i have searched from 4 days.

  227. I had this issue on my new windows 8 box and after going through all the steps I realized that I did not have SQLExpress installed on this box :) and after installation this issue got fixed.

  228. 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: TCP Provider, error: 0 – No connection could be made because the target machine actively refused it.

  229. Nicely covered. But there is more to it than meets the eye. This problem cropping up say from 2005 to 2012 gives me the impression that there is something basically not well done. Perhaps you should update this to cover SQL Server 2012. In Microsoft world, things can only get screwed up more.

  230. Yes my dear pinaldave sir
    iam also facing the same error u faced ,but the situation is different.in advance i thanking you and hopes your help

    i am managing two hosting in godaddy like hostA,hostB asp.net 4.0 ms sql 2008
    situation where i am facing this error is while i am trying to insert some datasto the sql server of hostB from hostA

    given is my codes

    SqlConnection con;
    SqlCommand cmd;
    con = new SqlConnection();

    cmd = new SqlCommand(My ConnectionString with (Data Source,Initial Catalog,User ID, Password));
    cmd.Parameters.AddWithValue(“@ImageID”, str);
    cmd.Parameters.AddWithValue(“@ImageName”, imgName);

    cmd.Connection = con;

    cmd.CommandText = “insert into Contents.ContentImageList values(@ImageID,@ImageName)”;
    con.Open();
    // int count = cmd.ExecuteNonQuery();

    //con.Close();

    while executing con.Open() the problem arising
    i googled lot for solution,still iam getting the error, what more i should do ?

  231. I just installed SQL Server 2008 Management studio Express on my Win xp machine.

    i tried connecting to local machine using :

    .\sqlexpress, (local)\sqlexpress, or .\SQLExpress, MyPCNAME\SQLExpress

    nothing is working, getting this error:

    —————————–
    Cannot connect to PC-NAME\SQLEXPRESS. 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)

  232. I still have the error. After I have done above. My environment is cluster in Windows Server 2008 R2 and SQL Server 2008 R2, but I still error.

    “A network related or instance specific error occurred while etablere a connection to SQL Server. The server was not found or was not accessible. Verify att instance name is correct and att SQL Server is Configured at lade remote connection. (Provider: Names Pipes Provider, error: 40 – Could not open a connection to SQL Server)

  233. This is awesome! I was looking to solutiion for the error connecting to instance of SQL Server 2008 R2 for a long time. Any blog was pointing to about same search path. Only here, and the last point – aliases – did a trick for me. Feels great. Thank you Pinal fo all you do.

  234. I followed every step in your blog trying to get SQL Server 2008 to function properly, and I still get the following error:
    (provider: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server).

    I can see the server from my VB.NET application but when I try to connect to it to get a list of DBs I get the above mentioned error.

    This is very frustrating.

  235. Dear Pinal

    The scene is that
    I have windows server 2003 and sql server 2000 installed, i have already set all the necessary setting.
    disabled the firwall
    enabled the tcp/pipes protocols
    added the sql server tcp port in the firewall exception

    and the 2nd that i have already installed the sqlclient over the client side other computer , that i need to connect to that server.
    but when i connect i recive an error message:

    Microsoft SQL Server Error
    SQLSTAT=08001
    Named Pipe Provider:can not connect to sql server.
    Error: [1326]

    Please help me in this regards

    KP

  236. I am not able to reproduce step 4 Enable Remote connection.
    For me its giving error as shown below. PLEASE HELP ME…

    TITLE: Microsoft SQL Server Management Studio
    ——————————

    Cannot show requested dialog.

    ——————————
    ADDITIONAL INFORMATION:

    Cannot show requested dialog. (SqlMgmt)

    ——————————

    Failed to retrieve data for this request. (SqlManagerUI)

    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&LinkId=20476

    ——————————

    Failed to connect to server JAGAN-HP\SQLEXPRESS. (Microsoft.SqlServer.ConnectionInfo)

    ——————————

    A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 – No process is on the other end of the pipe.) (Microsoft SQL Server, Error: 233)

    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=233&LinkId=20476

    ——————————
    BUTTONS:

    OK
    ——————————

    • I fixed the error by doing a full format on the hard-drive.

      When my system crashed I reinstalled the OS and SQL Server, but I only did a quick format before reinstalling everything.

      I’m guessing that some bit and pieces of the driver software were floating around because from that point on I could not get SQL Server to function.

      If necessary add this solution to your blog.

      Thanks for your response,

      Mark McCumber

      Sent from Windows Mail

  237. Hi All,

    SQL Server Name : ECARE432
    SQL Instance Name : SQLEXPRESS

    App.Config mentioned like this:

    This is Arun from Chennai. I have developed my first application in WPF (C#) with VS 2008 & SQL Server 2008. It works fine in

    my system. After deployment, it wont works in other systems. It shows the following error message.

    provider named pipes provider error 40 – could not open a connection to sql server 2008

    I have gone through the google and done the following steps but no use.

    1. Configuration Tools->SQL Server Configuration Manager->SQL Native Client Configration
    Aliases->
    Alias Name -> ECARE432,1433
    Port Number -> 1433
    Protocol -> TCP/IP
    Server Name -> ECARE432

    2. TCP/IP is enabled. Protocols -> TCP/IP Properties ->
    IP1 ->
    Acive – Yes
    Enabled – Yes
    IP Address – My system IP address
    TCP Dynamic Ports – Blank
    TCP Port – 1433

    IP2 ->
    Acive – Yes
    Enabled – Yes
    IP Address – 127.0.0.1
    TCP Dynamic Ports – Blank
    TCP Port – 1433

    IPALL ->
    TCP Dynamic Ports – Blank
    TCP Port – 1433

    3. SQL Server Browser is running.

    4. Server Name is correct. No typo mismatch.

    5. Client machine is able to ping my machine. (PING ECARE432 is working)

    6. TCP 1433 and UDP 1434 Exception added to Firewall. Also Turned off the Firewall in both my system and the client system.

    7. sqlbrowser.exe is added to the Firewall Exception List.

    8. Allow Remote Connections enabled under Connections in SQL Server Properties.

    9. Visual Studio–>Tools–>Options–>Database Tools–>Data Connections–>
    Changed “SQL Server Instance Name” from “sqlexpress” to blank.

    Please guide me how to fix this issue.

  238. all the above failed, also you can add server IP address and server name in host file which is in drivers folder, this has to be done in client system from where you are trying to connect
    C:\Windows\System32\drivers
    add the details like
    192.168.XX.XX SERVERNAME

  239. Hello friends,
    I am using window application and i have used crystal reports in it and i have used odbc for connection, and when i developed it i have sqlserver 7 it is nt autheticating server no username password required.
    now i want to use that application on sqlserver 2008r2,
    i have windows server 2003 where my db is located,
    but from client pc i am not able to create ODBC through
    NT authenticate. i am getting error like
    Connection filed :
    SqlState:’28000′
    sql server error:18452
    login is from an untrusted domain and cannot be used with windows authentication.

  240. In addition, if you are trying to connect to a SQL Server Instance other than default, you need to open the port used by that instance.

    In case its a dynamic port (which is default), you need to add an Inbound Firewall rule for each instance’s sqlservr.exe from “Program Files\Microsoft SQL Server\MSSQL11.InstanceName\MSSQL\Binn” location.

    Ensure this is inline with your organisation’s security regime as you might only open specific ports for each instance. In this case you need to assign a unique port to each SQL Server Instance.

  241. I have seen the same error on several of my computers but i use only a local database created with SQL 2008 Express. The interesting is that it happens simply by chance and not always.

  242. Pingback: SQL SERVER – Weekly Series – Memory Lane – #030 | SQL Server Journey with SQL Authority

  243. Easy way is on your server name type your computer name back slash server name and it will work like PC1\MYSQLSERVER

  244. 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)

  245. Hi,

    Background:
    SQL Enterprice 2008 R2, Visual Studio 2010 running Win 7 Ent 64 bit, App in Asp.Net
    SQLconnStr = “Server=MYCOMPUTER\SQLEXPRESS;Initial Catalog=APPDB;Integrated Security=SSPI”

    Problem:
    “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) ”

    Troubleshooting:
    All network connections are enabled in the Server – named pipe, tcp, and shared memory.
    Ran it with Win Firewall turned off – still the problem persist.
    Ensure Win Firewall has port 1433 enabled – problem still persist.
    Ping server – ok, sqlcmd -L – return the right server\instance
    SQL Management Studio – connects with no problem
    Ensure remote connection is enabled on the server
    Install the Enterprice 2008 on another machine running Win 8, ran same App – No problem

    Very puzzled, can someone shed some light? Thanks in advance!

    Reply

  246. I have found that testing the linked server from a remote connection of SSMS doesn’t work ether, you have to be logged on to the server.

  247. I solved this problem by using Management Studio, but specify a port name. eg in the Server name = 192.0.12.11, 1433

  248. Hi,

    I am getting similar error “SqlState HYT00, Login timeout expired
    A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.
    TCP Provider: Error code 0x6F”
    while trying to connect from Linux using “sqlcmd -S VM-5555 -U DWH_ETL”

    whereas I am able to connect the same server and instance from MS SQL management studio, I am also able to ping the server from backend.

    Entries of .ini are

    $cat odbc.ini
    [VM-5555]
    Driver=/opt/microsoft/sqlncli/lib64/libsqlncli-11.0.so.1790.0
    Server=tcp:VM-5555.xxx.nsroot.net\MSSQL_DWH_SIT,1443
    Database=DWH_Report_SIT

    cat odbcinst.ini
    [SQL Server Native Client 11.0]
    Description=Microsoft SQL Server ODBC Driver V1.0 for Linux
    Driver=/opt/microsoft/sqlncli/lib64/libsqlncli-11.0.so.1790.0
    Threading=1
    UsageCount=1

    I tried \ & \\ before instance name.

    I was also able to connect other server from Linux, but without using the instance name.

    that time entry in .ini was similar

    cat odbc.ini_old
    [VM-1272-6223]
    Driver=/opt/microsoft/sqlncli/lib64/libsqlncli-11.0.so.1790.0
    Server=tcp:vm-1222.xxx.nsroot.net
    Database=DWH_Report_DEV

    Can someone pls suggest what is wrong or how can I eliminate contributing factor.

    thanks

  249. In our cluster, SQL Server browser service was in running status but still this error poppped up (Named pipes provider error). I restarted the browser service, after which applications were able to connect successfully.

  250. It was a combination of things, but ultimately clearing the Dynamic Ports value = 0 in all the IP setting finally resolved my issue

  251. I have the same error occuring in my phone nokia x3-02 how to solve this pls help me..could not connect to server error occuring whilst opening

  252. Hi Sir,

    I created an app in c# , I use visual studio 2010 and SQL server 2008 ,

    my client use SQL server 2012 Express edition.

    when he try to run exe , at time of connecting to database it cause error.
    same error whet you mention in this blog.
    I am using connection string from confiq file.

    I want to ask that what is the reason for this error . I tried all your ways but no success.
    is this because of different sql server?
    Please reply

    Manu

    Kids Mitra
    A place for kids
    http://www.kidsmitra.com

  253. By means of this blog, I was able to make a connection with the SQL server on a virtual machine. Very clear step by step approach. Thanks a lot!

  254. TITLE: Connect to Server
    ——————————

    Cannot connect to umair-PC\SQLEXPRESS.

    ——————————
    ADDITIONAL INFORMATION:

    This version of Microsoft SQL Server Management Studio Express can only be used to connect to SQL Server 2000 and SQL Server 2005 servers. (Microsoft.SqlServer.Express.ConnectionDlg)

    ——————————
    BUTTONS:

    OK
    ——————————
    TITLE: Connect to Server
    ——————————

    Cannot connect to umair-PC\SQLEXPRESS.

    ——————————
    ADDITIONAL INFORMATION:

    This version of Microsoft SQL Server Management Studio Express can only be used to connect to SQL Server 2000 and SQL Server 2005 servers. (Microsoft.SqlServer.Express.ConnectionDlg)

    ——————————
    BUTTONS:

    OK
    ——————————
    sql server not connect. error establish connection error

  255. While I tried to open a New Query windows I got following error message;
    “Object reference not set to an instance of an object”
    I am using Microsoft SQL Server Management Studio pls sir am waiting for solve this problem pls pls help

  256. Hi Guys,

    A few computers on my network can connect with the SQL server and a few computers are having this specific problem. So I am guessing the problem is with the system that cant connect instead of the server. I will really appreciate any help

    Thank You

  257. We had one workstation that got this error while no others did, we found that shortening the computer name to 15 characters fixed it. We had been warned about this NetBIOS limitation when setting the name, but ignored the error as NetBIOS protocols are not enabled – but it must have come into play somewhere as this was the only change that we made, unless something about leaving and rejoining the domain fixed it. BTW, our problem was that this machine could not connect to server outside of our subnet, even though the server was still on the same domain. Bottom line: It’s worth checking your computer name and shortening it to be 15 characters or less if it is longer than that.

  258. Make sure SQL Server and SQL Server Browser are exempted by the firewall on the server machine. This is done by putting sqlservr.exe and sqlbrowser.exe as an exception in the windows firewall.

    I just lost all my hair figuring it out, hope this helps others

  259. Thanks Bro.. Its is Working Fine. Problem in SQL Server Browser is not Enabled and also, it is disabled the Start Button.
    So, I checked in the Service Tab and Changed the Start Mode to “Automatic”.
    Then in General Tab , I started the Service. It is Working Fine.

  260. Hi Pinal,

    I am getting the same error when connecting to SQL Server 2008 R2 from my WCF Service. I am using .NET SQLClient namespace.

    The funny part is that there is one more ASMX Web Service which is able to connect to the same server. Also, I created a small .NET Winforms app to test the connection string and it is also able to connect to the same SQL Server.

    This WCF Service reads the connection string from App.config and runs properly in DEV and TEST machines. However, I am facing this issue in the client’s environment and I do not have much control to try different things. Also, Names Pipes is disabled due to some reason and using TCP/IP is the only option.

    I have tried the following to enforce a TCP/IP connection but got the same error:
    1) Used IP address and Port instead of Server’s name.
    2) Used “Data Source=tcp:ServerName” instead of “Data Source=tcp:ServerName”.
    3) Used Network Library attribute in the connection string.

    Any inputs would be greatly appreciated.

    Thanks,
    Ashish

  261. i tried the port number and everything still getting the error number 40: I am new to SQL server and currently using SQL server 2012 on windows 8. please let me know how to fix this error. It has taken my lot of time.

    Thanks

  262. System.Data.SqlClient.SqlException (0x80131904): A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 – The token supplied to the function is invalid)

    System.ComponentModel.Win32Exception (0x80004005): The token supplied to the function is invalid
    at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
    at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
    at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
    at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
    at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
    at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
    at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
    at System.Data.SqlClient.SqlConnection.Open()
    at Utilities.SqlHelper.ExecuteDataset(String connectionString, CommandType commandType, String commandText, SqlParameter[] commandParameters)
    ClientConnectionId:a1f5685c-d849-4e8c-9301-c0203f3b8a8d

  263. thanks a lot. One of my colleagues referred me this link. It solved my connection errors while I have tried to connect SQL Management studio from other systems. thanks a lot!!

  264. Hi to everybody,
    some clients can connect to server( to Db) but some clients can’t connect to server(to Db).
    Thanks for your reply.

  265. Thank you Dave! I ran into this problem when upgrading my replication publisher to SQL 2012. The SQL 2005 subscriber could not connect until I followed your steps to add incoming Windows firewall policies for UDP and TCP.

  266. 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)

  267. a network -related or instance -specfic error occured while establishing a connection to sql server. the server was not found or was not accessibe verify that the instance name is correct and that sql server is configured to allow remote connections.(provider: SQL Network interfaces,error,error: 26- Error locating server instance specficied)

  268. Dear sir, kindly help me, step by step.
    a network -related or instance -specfic error occured while establishing a connection to sql server. the server was not found or was not accessibe verify that the instance name is correct and that sql server is configured to allow remote connections.(provider: SQL Network interfaces,error,error: 26- Error locating server instance specficied)
    thanks,

  269. On top of everything, we have to ensure the server name we have provided is correct or not. Which I have missed and got the same error even after I am done with the afore mentioned steps.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s