2011-11-17 147 views
2

我需要通过带有端口的IP地址连接到远程SQL Server。允许SQL Server远程连接

但是,当我ping通的IP地址,那么答复也是如此。但是当我尝试建立失败的连接时。

我尝试使用Management Studio和命令提示符。

我的命令是:

sqlcmd -S [IP],[port] -U [user] -P [password] 

错误报告如下:

HResult 0x274C, Level 16, State 1
TCP Provider: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..
Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : Login timeout expired.

我想知道

  1. 有没有从我的客户端的任何缺少的步骤为此我无法建立连接?

  2. 或者这是服务器配置(允许远程连接)

+0

SQL Server的**版本**(2000,2005,2008 ??)和** edition **(Standard,Express,Enterprise)您正在使用? –

+0

我真的很抱歉。其实我是.net新手。我不知道在服务器端使用的是什么版本和版本。但在客户端,我正在尝试连接sqlserver 2008和express版本。 – PAryan

+0

你需要找出那些信息。例如,SQL Server ** Express **默认情况下不接受远程连接。它可以配置为这样做 - 但它需要在服务器端进行配置 –

回答

1

它看起来像你实际上是想你想连接到数据库名称的事项:

EX:sqlcmd -S [IP],[port]\[DBNAME] -U [user] -P [password]

0

除了将Windows防火墙配置为允许TCP端口1433上的传入连接外,您还需要启动SQL Server Browser服务。可以在开始菜单 - Microsoft SQL Server 2008 R2 - 配置工具 - SQL Server配置管理器中找到该服务。之后,点击左侧的SQL Server服务,然后点击右侧的SQL Server浏览器。这是默认禁用的。

  1. 右键单击SQL Server浏览器,然后选择属性
  2. 单击服务选项卡
  3. 对于物业启动模式,选择自动
  4. 单击应用
  5. 单击登录选项卡
  6. 选择适当的帐户登录(我使用内置的服务帐户)
  7. 单击应用
  8. 单击开始
  9. 单击确定

这解决了在Windows Server 2008 R2与SQL Server 2008 R2 Express版本上我的问题。

0

检查主动托管数据库的服务器上的防火墙设置。默认情况下,Windows Server将阻止到数据库服务器的所有远程连接。