Could not connect to the server
TITLE: Connect to Server
------------------------------

Cannot connect to ********.

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

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

------------------------------

The system cannot find the file specified

------------------------------
BUTTONS:

OK
------------------------------
September 2nd, 2015 11:18pm

Hi Vaibhav,

Here are the7 things to check to resolve A network-related or instance-specific error occurred while establishing a connection to SQL Server

Also refer Pinal's suggestion at SQL SERVER FIX : ERROR : (provider: Named Pipes Provider, error: 40 Could not open a connection to SQL Server) (Microsoft SQL Server, Error: )

Steps are:

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 findtutorial 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.

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

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

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

Right Click on TCP/IP >> Click on Enable

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

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 byfirewall. 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

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

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

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

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

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

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.

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

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

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

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

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

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.

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

Free Windows Admin Tool Kit Click here and download it now
September 2nd, 2015 11:28pm

1) Double-check your server name.

2) where is this database server? somewhere in the n/w, domain or local?

3) Are you able to ping the server?

September 2nd, 2015 11:31pm

Step 1

Make sure you are able to ping the physical server where SQL Server is installed from the client machine. If not, you can try to connect to the SQL Server using an IP Address (for default instance) or IP Address\Instance Namefor a named instance. 

resolving issues connecting to sql server

If it resolves using an IP address, you can add the SQL Server machine into /etc/host file. To add the entry in the/host file type %SystemRoot%\system32\drivers\etc\ in the run window and open the host file using Notepad. In the below image I added IP address 74.200.243.253 with a machine name of SQLDBPool. Now I should be able to use the machine name instead of the IP address to connect to the SQL Server.

try to connect to the sql server using an ip address


Free Windows Admin Tool Kit Click here and download it now
September 3rd, 2015 12:21am

WIMD, if you copy text straight off other people's articles from the Internet, then please have the courtesy to mention that this isn't your text and also give credit to the person who spent time and effort on producing the text. Mentioning in the beginning of your answer where you got this from and who wrote it, is considered basic netiquette.

(My apologies if you happens to be Jugal Shah, working under a pseudonym.)

September 3rd, 2015 2:58am

VIMD, and Rachit Sikroria  !!!

If your answer was copied from someone else post, without getting his explicit approval, then this is stealing!!
IN THIS CASE PLEASE REMOVE IT FROM THE FORUM!

Stealing, and giving credits to where it was stolen from, does not make right!

You should post link to the original post instead of copy his work to here.

* if you are the original author please inform us :-)
  in this case WELL

Free Windows Admin Tool Kit Click here and download it now
September 3rd, 2015 3:08am

I agree with Tibor and Ronen. Unfortunately WIMD (his name is Dinesh Vishe) has habit of copying and pasting without giving credit to original author. I have presonally requested him many a times but he does not pays any attention.

For question,

This is common scenario which can have many reasons. Rick Byham from MS  team has written good article I suggest you follow this

September 3rd, 2015 3:09am

Ronen,

Rachit did have the URL where the text comes from, in the beginning of the reply (perhaps a bit vague that the text following come from the article linked, but stil

Free Windows Admin Tool Kit Click here and download it now
September 3rd, 2015 3:12am

Ronen,

Rachit did have the URL where the text comes from, in the beginning of the reply (perhaps a bit vague that the text following come from the article linked, but still...).

September 3rd, 2015 3:12am

TiborK ,Stealing, and giving credits to where it was stolen from, does not make right!

Unless the original EXPLICITLY approve this (WIKI articles for example usually approve it in the licence), but even in this case it is THIS IS NOT ETHICAL to copy as it as in my op

Free Windows Admin Tool Kit Click here and download it now
September 3rd, 2015 3:16am


I had orginally posted only the links but VIMD's post was irritating and forced me to edit my post later. I will revert it back to just links now. I myself dislike such practices but I have seen people ignoring the replies with j
September 3rd, 2015 3:18am

VIMD, and Rachit Sikroria  !!!

If your answer was copied from someone else post, without getting his explicit approval, then this is stealing!!  (I can understand it might be mistake and that someone did not understand, but this does not change the fact)
IN THIS CASE PLEASE REMOVE IT FROM THE FORUM!

Stealing, and giving credits to where it was stolen from, does not make right! moreover, this is not just illegal in most countries, THIS IS NOT ETHICAL (even if the country laws do not say so!). We as people that writes blogs and articles do not want that someone will do it for us as well.

You should post link to the original post instead of copy his work to here.

* if you are the original author please inform us :-)
  in this case WELL

September 3rd, 2015 7:01am

If the link requires registration, you need to indicate it to prevent people wasting time.
Free Windows Admin Tool Kit Click here and download it now
September 3rd, 2015 9:26pm

Since VIMD did not confirms that the message was originally written by himself, or that he have explicit approval to post it here from the original author, I cleared the content of the message! posting the message as it is looks like illegal action.
September 12th, 2015 5:49pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics