Fixed -- Could not open a connection to SQL Server

Below are steps to check for fine working

1 SQL Server Services
2 SQL Server (MSSQLSERVER)
3 SQL Server Browser
4 Aliases
5 SQL Server Default Port 1433
6 Client Protocols, "TCP/IP", Property, 1433
7 SQL Server Management Studio, right click, property and click on "Connections", "Allow remote Connections to this server"
8 Ping 
9 Firewall default port block 1433

From: http://www.technologycrowds.com/2014/02/could-not-open-connection-to-sql-server.html

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

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

An error has occurred while establishing a connection to the server.  When connecting to SQL Server, 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: xxx)

SERVER SIDE

Step 1: SQL Server Configuration Manager 

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”.
- SQL Browser service status is “Running”. (if you have got an instance that is not by default with port 1433)
- Check if TCP/IP and NP are enabling

Step 2: Firewall
Disable your Firewall and check if the issue doesn't occur follow the both articles below

  How do I open the firewall port for SQL Server on Windows Server 2008
  Configuring the Windows Firewall to Allow SQL Server Access

Step 3 : Enable Remote Connection
Right click on the server node and select Properties. Go to Left Tab of Connections and check “Allow remote connections to this server”

  To configure the Database Engine to accept remote connections


CLIENT SIDE

Step 1 : Connection string is not correct or point to not a real server. Be ensure of the instance name

Step 2 : Check if the port is opened
telnet <your_target_machine> <TCP_Port>

Step 3 : Ping server
ping -a <your_target_machine>    
ping -a <Your_remote_IPAddress>
Run “net view \\your_target_machine” 

Step 4 : SQL Alias.
On my end I was working on a 64 bit machine but had to remove an alias under the SQL Configuration Manager -> 32 Bit Config -> Alias.
Also confirm with cliconfg.exe

The registry keys are: 
32 bit:  HKLM\SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo
64 bit:  HKLM\SOFTWARE\Wow6432Node\Microsoft\MSSQLServer\Client\ConnectTo
 
Step 5 : Try the connection out of your application
SQLCMD –E -S tcp:<IPAddress>[\<InstanceName>],<Port> 
SQLCMD –E -S tcp:<Your_target_machine>[\<InstanceName>],<Port>

Try the FQDN to connect to the server that is running Microsoft SQL Server. 
SQLCMD –E -S tcp:<Your_target_machine>.<FQDN>[\<InstanceName>],<Port>


From http://blogs.technet.com/b/mdegre/archive/2011/06/04/resolve-sql-server-connectivity-issues.aspx

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

http://blog.sqlauthority.com/2009/05/21/sql-server-fix-error-provider-named-pipes-provider-error-40-could-not-open-a-connection-to-sql-server-microsoft-sql-server-error/



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章