Wednesday, February 10, 2016

Why am I getting “Cannot Connect to Server - A network-related or instance-specific error”?

I get the following error when trying to connect to SQL Server:
Cannot connect to 108.163.224.173.
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: 1326)
This error is thrown when I try to configure my database to gridview in Visual Studio 2010. I'm at a loss as to how to debug this error.
How would you debug this error? What steps should I take in order to determine what is really going on here, in addition to the one mentioned in the error message?
share|improve this question
1  
try pinging this server – Zia Aug 5 '13 at 14:28
7  
A ping is unreliable for testing SQL Server connectivity, ICMP echo request are disabled by default in Windows Server. An invalid username or password is not what the error is telling you at all, that's a completely different error. – Sean Aug 5 '13 at 14:32
    
Try this article, it goes through pretty much all the steps you will need to troubleshoot your connectivity problems: social.technet.microsoft.com/wiki/contents/articles/… – Sean Aug 5 '13 at 14:33
    
See my answer here with my screen shot if you received this error with SQL Server {version} Express, when setting it up for the first time. I came back to StackOverflow and used my answer again because it was the only one that worked. stackoverflow.com/questions/1391503/… – MacGyver Jan 21 '14 at 3:47
    
I had this Issue on my virtual Server when I wanted to connect to the localhost. It appeared there was some kind of error when launching the OS - in my case everything was solved fortunately with a clean reboot. – Qohelet Feb 13 '15 at 7:33
I found the following techniques helpful:
  • From 7 things to check to resolve "A network-related or instance-specific error occurred while establishing a connection to SQL Server…":
    1. Make sure your database engine is configured to accept remote connections:
      • Start > All Programs > SQL Server 2005 > Configuration Tools > SQL Server Surface Area Configuration
      • Click on Surface Area Configuration for Services and Connections
      • Select the instance that is having a problem > Database Engine > Remote Connections
      • Enable local and remote connections
      • Restart instance
    2. You may need to create an exception on the firewall for the SQL Server instance and port you are using:
      • Start > Run > Firewall.cpl
      • Click on exceptions tab
      • Add sqlservr.exe (typically located in C:\Program Files (x86)\Microsoft SQL Server\MSSQL.x\MSSQL\Bin, check your installs for the actual folder path) and port (default is 1433)
      • Check your connection string as well
  • From FIX : ERROR : Could not open a connection to SQL Server:
    1. Check if your SQL server services is up and running properly:
      • Go to All Programs > Microsoft SQL Server 2008 > Configuration Tools > SQL Server Configuration Manager > SQL Server Services
      • Check to make sure SQL Server service status is Running.
      In addition, ensure that your remote server is in the same network. Run sqlcmd -L to ascertain if your server is included in your network list.
    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.
share|improve this answer
3  
Enable TCP/IP in SQL Server Configuration was the solution for me when using SQL Server 2014 Express. – butteredtoast Oct 21 '14 at 15:32
12  
Today I spent a lot of time on this, finally what worked for me is: Open Sql Server Configuration Manager --> Protocols for <INSTANCE> --> TCP/IP --> IP Addresses(Tab). Go to the last entry IP All and mention TCP Port 1433. Now restart SQL Server (<INSTANCE>) using services.msc. After this, the problem got resolved! – user1336087 Feb 24 '15 at 13:26
    
I was also facing the particular problem on my local Sql server and solved by checking the local services of operating system and Searched for the specific Sql services and start them one by one. It worked perfect. – Faisal Naseer Mar 10 '15 at 6:28
2  
I too had the same problem, logged on to sql server found that mssqlserer service was stopped, started it. Was able to connect to the instance now – Rak Apr 4 '15 at 9:00
    
#3 did it for me – Michal Shulman May 7 '15 at 19:00
I got Solution for me :
Open "SQL Server Configuration Manager"
Now Click on "SQL Server Network Configuration" and Click on "Protocols for Name"
Right Click on "TCP/IP" (make sure it is Enabled) Click on Properties
Now Select "IP Addresses" Tab -and- Go to the last entry "IP All"
Enter "TCP Port" 1433.
Now Restart "SQL Server .Name." using "services.msc" (winKey + r)
It Will Work...
share|improve this answer
If none of the above solutions work (nothing worked for me) then just RESTART your computer and you will be able to connect to your sql server (localhost).
share|improve this answer
I have run SQL Server Browser service into SQL Server Configuration Manager. Installation can't discover newly created service without this.
share

No comments:

Post a Comment