4

I am trying to connect to MS SQL Server 2008 R2 Express Edition through a Remote computer. I am getting 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)

On running SELECT CONVERT(char(20), SERVERPROPERTY('InstanceName')) instancenameting

I get NULL as the instance name. I have started SQL Browser service, checked TCP/IP are enabled.

What else can be done?

4

2 回答 2

2

Use

Data Source=IP-0A6E3175;Network=DBMSSOCN;...

Or

Data Source=<<ip address>>;Network=DBMSSOCN;...

You'll also need to make sure that TCP/IP is enabled on the host using SQL Server Configuration Manager, that you aren't blocked by a firewall, etc.

And just for kicks, also please try:

Data Source=<<ip address>>\SQLEXPRESS;Network=DBMSSOCN;...
于 2013-03-06T20:07:29.380 回答
1

In addition to Aaron's suggestion to ensure your connection string uses tcp, run SQL Server Configuration manager and check the following:

  • do you have more than one instance?
  • tcp/ip enabled?
  • if the instance you are targeting is not the default instance, it will not be on port 1433 but rather some dynamic port. The Microsoft libraries figure out which port using SQL Server Browser on port 1434. Your firewall needs to allow that also (UDP).
  • if your Express instance is the only instance, you can change to use port 1433. Then you don't need SQL Server Browser.
于 2013-03-06T20:40:47.367 回答