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/



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值