Error Has Occurred While Establishing A Connection To SQL Server 2005 Which Does Not Allow Local and Remote Connections发生错误的同时,建立连接到SQL Server 2005不容许本地和远程连接
When connecting to an instance of Microsoft SQL Server 2005 database, including SQL Server 2005 Express, Developer and Enterprise editions, for authentication or accessing and retrieving and updating the data, the the following error message may appear.当连接到一个实例的Microsoft SQL Server 2005数据库,其中包括的SQL Server 2005 Express ,开发版和企业版,为验证或存取和检索和更新数据,该可能出现下列错误讯息。 The problem happens no matter the connection is originated from remote computer or on SQL Server local computer itself, and can be caused by any program, such as SQLCMD utility, used to connect to SQL Server.问题的发生,无论是连接源自远程计算机或SQL Server的本地计算机本身,可造成的任何程序,如SQLCMD实用工具,用于连接到SQL Server 。
Sqlcmd: Error: Microsoft SQL Native Client: An error has occurred while establishing a connection to the server. SQLCMD可以:错误:在Microsoft SQL本土客户:发生错误,而建立一个到服务器的连接。 When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.当连接到SQL Server 2005中,这样的失败可能造成的事实,即根据默认设置SQL Server不允许远程连接。
Or,或,
An error has occurred while establishing a connection to the server.发生了错误,而建立一个到服务器的连接。 When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.当连接到SQL Server 2005中,这样的失败可能造成的事实,即根据默认设置SQL Server不允许远程连接。 (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 2) (提供者:命名管道提供商,错误: 40 -无法打开连接到S QLS erver) ( M icrosoftS QLS erver,错误: 2 )
This problem may occur when SQL Server 2005 is not configured to accept incoming local and remote connections, which is disabled by default in SQL Server 2005 Express Edition, SQL Server 2005 Developer Edition and also SQL Server 2005 Enterprise Edition.可能会发生此问题时, SQL Server 2005是没有配置为接受传入的本地和远程连接,这是默认情况下禁用在SQL Server 2005 Express版, SQL Server 2005的开发版和也的SQL Server 2005 Enterprise Edition的。 To solve the connection forbidden problem, SQL Server 2005 needs to configure to allow incoming local and remote connections.要解决方面禁止的问题, SQL Server 2005的需要来配置,以允许传入本地和远程连接。
Firstly, ensure that SQL Server 2005 is configured properly to allow incoming connections on the instance of database server, else enable and turn on the local and remote connections setting.第一,确保SQL Server 2005的配置是否正确,允许传入的连接上的实例数据库服务器,否则,使把对本地和远程连接设置。
- Click Start button, then go to Programs or All Programs, then select Microsoft SQL Server 2005 , followed by Configuration Tools .单击开始按钮,然后到程序或所有程序,然后选择了Microsoft SQL Server 2005 ,其次是配置工具 。 Click and run the SQL Server Surface Area Configuration .点击和运行SQL Server表面积配置 。
- On the “SQL Server 2005 Surface Area Configuration” page, click Surface Area Configuration for Services and Connections .关于“ SQL Server 2005的表面积配置”页上,单击表面积的配置服务和连接 。
- On the “Surface Area Configuration for Services and Connections” page, expand Database Engine tree, click Remote Connections .关于“表面积的配置服务和连接”页上,扩大数据库引擎的树中,单击远程连接 。
- Select Local and remote connections , or Local connections only which applicable only if there is no remote system tries to connect to the SQL Server, useful when you just trying to connect and authenticate with the server after installing.选择本地和远程连接 ,或本地连接只 ,其中只适用于如果没有远程系统会尝试连接到SQL Server ,有用时,你刚才尝试连接和验证与服务器安装完毕后。
- Select the appropriate protocol to enable to local and/or remote connections environment.选择适当的议定书,使本地和/或远程连接的环境。 To ensure maximum compatibility, select Using both TCP/IP and named pipes .以确保最高的相容性,选择使用TCP / IP和命名管道 。
- Click Apply button when done.点击应用按钮时,做了。
- Click OK button when prompted with the message saying that “Changes to Connection Settings will not take effect until you restart the Database Engine service.”单击确定按钮时,提示讯息,他说: “更改连接设置将不会生效,直到您重新启动数据库引擎的服务” 。
- On the “Surface Area Configuration for Services and Connections” page, expand Database Engine , then click Service .关于“表面积的配置服务和连接”页上,扩大资料库引擎 ,然后单击服务 。
- Click Stop button to stop the SQL Server service.点击停止按钮来停止SQL Server服务。
- Wait until the MSSQLSERVER service stops, and then click Start button to restart the MSSQLSERVER service.等到MSSQLServer服务站,然后单击开始按钮,重新启动MSSQLServer服务。
Secondly, SQL Server Browser service has to be enabled to allow for local and remote connections if SQL Server 2005 is running by using an instance name and users are not using a specific TCP/IP port number in the connection string.其次, SQL Server的浏览器服务已被启用,让本地和远程连接,如果SQL Server 2005的运行使用,例如名称和用户使用的不是一个具体的TCP / IP端口的数目在连接字符串中。
- Click Start button, then go to Programs or All Programs, then select Microsoft SQL Server 2005 , followed by Configuration Tools .单击开始按钮,然后到程序或所有程序,然后选择了Microsoft SQL Server 2005 ,其次是配置工具 。 Click and run the SQL Server Surface Area Configuration .点击和运行SQL Server表面积配置 。
- On the “SQL Server 2005 Surface Area Configuration” page, click Surface Area Configuration for Services and Connections .关于“ SQL Server 2005的表面积配置”页上,单击表面积的配置服务和连接 。
- On the “Surface Area Configuration for Services and Connections” page, click SQL Server Browser .关于“表面积的配置服务和连接”页上,单击SQL Server的浏览器 。
- Select Automatic as the Startup type to start SQL Server Browser service automatically every time system starts.选择自动作为启动类型启动SQL Server浏览器服务的自动每一次系统启动。
- Click Apply button.点击应用按钮。
- Click on Start button to start the service immediately.点击开始按钮,启动服务,立即。
- Click OK button.单击确定按钮。
Finally, if remote computer needs to connect and access SQL Server, an exceptions in Windows Firewall included in Windows XP SP2 (Service Pack 2), Windows Server 2003 and Windows Vista needs to be created.最后,如果远程计算机需要连接和存取SQL Server ,一例外,在Windows防火墙包含在Windows XP SP2 ( Service Pack 2中) , Windows Server 2003和Windows Vista的需要创造。 If you’re using third-party firewall system, the exception rules also needed to be created to allow external remote connections to the SQL Server 2005 and SQL Server Browser Service to communicate through the firewall, else connections will be blocked.如果您使用的第三方防火墙系统,例外的规则也需要加以创造,以容许外来的远程连接到SQL Server 2005和SQL Server浏览器服务的沟通,通过防火墙,否则,连接会被拦截。 Consult the firewall manual for more details.谘询防火墙手册,了解更多的细节。 Each instance of SQL Server 2005 must have its own exception, together with an exclusion for SQL Server Browser service.每个SQL Server 2005实例必须有它自己的例外,加上排除SQL Server Browser服务。
SQL Server 2005 uses an instance ID as part of the path when you install its program files. SQL Server 2005的使用实例ID作为路径的一部分当您安装其程序文件。 To create an exception for each instance of SQL Server, you must identify the correct instance ID.创造一个例外,每个SQL Server实例,您必须确定正确的实例ID 。 To obtain an instance ID, follow these steps:以获取实例ID ,请执行下列步骤:
- Click Start button, then go to Programs or All Programs, then select Microsoft SQL Server 2005 , followed by Configuration Tools .单击开始按钮,然后到程序或所有程序,然后选择了Microsoft SQL Server 2005 ,其次是配置工具 。 Click and run the SQL Server Configuration Manager .单击并运行SQL Server配置管理 。
- In “SQL Server Configuration Manager”, click the SQL Server Browser service in the right pane, right-click the instance name in the main window, and then click Properties .在“ SQL Server配置管理器” ,按SQL Server Browser服务在右窗格中,右键单击实例名称在主窗口,然后单击属性 。
- On the “SQL Server Browser Properties” page, click the Advanced tab, locate the instance ID in the property list.关于“ SQL Server的浏览器属性”页上,单击高级选项卡,找到实例ID在财产清单。
- Click OK button.单击确定按钮。
Then create an exception for SQL Server 2005 in Windows Firewall.然后创建一个例外为SQL Server 2005在Windows防火墙。
- Click on Start button, the click on Run and type firewall.cpl , and then click OK.点击开始按钮,按一下运行,并键入firewall.cpl ,然后单击确定。 For Windows Vista, type firewall.cpl in Start Search box and press Enter key, then click on Allow a program through Windows Firewall link on left tasks pane.适用于Windows Vista ,键入firewall.cpl在开始搜索框中并按下回车键 ,然后按一下就允许程序通过Windows防火墙连接对左任务窗格。
- In “Windows Firewall”, click the Exceptions tab, and then click Add Program .在“ Windows防火墙” ,按例外选项卡,然后单击添加程序 。
- In the “Add a Program” window, click Browse button.在“添加程序”窗口中,单击浏览按钮。
- Click the C:\Program Files\Microsoft SQL Server\ MSSQL.1 \MSSQL\Binn\sqlservr.exe executable program, click Open button. MSSQL.1 with is a placeholder for the instance ID that is obtained from previous procedure.单击C : \程序文件\ Microsoft SQL Server的\ mssql.1 \ mssql \ binn \ Sqlservr.exe的可执行程序,单击打开按钮。 mssql.1同是一个占位符,为实例ID是获得从先前的程序。 Note that the path may be different depending on where SQL Server 2005 is installed.请注意,路径可能有所不同,视乎情况下SQL Server 2005的安装。
- Click OK button.单击确定按钮。
- Repeat steps 1 through 5 for each instance of SQL Server 2005 that needs an exception.重复步骤1到5为每个SQL Server 2005实例需要一个例外。
- For SQL Server Browser service, locate the C:\Program Files\Microsoft SQL Server\90\Shared\sqlbrowser.exe executable program, and click Open button.为SQL Server Browser服务,找到C : \程序文件\ Microsoft SQL Server的\ 90 \共享\ sqlbrowser.exe可执行程序,并单击打开按钮。
- Click OK button.单击确定按钮。
IMPORTANT : This is a machine translated page which is provided "as is" without warranty. 重要说明 :这是一个机器翻译网页是“按原样”提供的担保。 Machine translation may be difficult to understand.机器翻译可能很难理解。 Please refer to请参阅 original English article英文原版的文章 whenever possible.只要有可能。
Share and contribute or get technical support and help at分享和贡献,或取得技术的支持和帮助,在 My Digital Life Forums 我的数字生活论坛 . 。
Related Articles相关文章
- How to Customize, Modify or Change WordPress Database Connection Error Page如何自订,修改或改变的WordPress数据库连接错误页
- Uninstall and Remove Multiple Database Instances of Microsoft SQL Server 2005卸载和删除多个数据库实例的Microsoft SQL Server 2005
- Remote Connections Manager for RDP, VNC, SSH, RLogin and More mRemote Free Download远程连接经理的RDP , VNC的, SSH的, rlogin和更mremote免费下载
- Connect to Remote Computer using Specific Non Standard Port using Remote Desktop Connection Client连接到远程计算机上使用特定的非标准端口使用远程桌面连接客户端
- Easily Maintain Multiple Remote Desktop Connections with visionapp Remote Desktop (vRD)容易保持多个远程桌面连接与visionapp远程桌面( vrd )
- Modify and Change Remote Desktop Listening Port修改和改变远程桌面的侦听端口
- Workaround to Run VNC Server in Windows Vista其他可行方案运行的VNC服务器在Windows Vista
- Oracle Database Link Oracle数据库的连接
- Workaround for Remote Desktop Client to Connect to Localhost (Local Terminal Server Service)可行的远程桌面客户端连接到本地(本地终端服务器服务)
- Oracle EXP-00091 Error When Export Database甲骨文进出口- 00091时发生错误,进出口数据库
















April 17th, 2008 02:34 2008年4月17日2时34分
Thank you for this.感谢你给我这次。 Very useful.非常有用。
July 22nd, 2008 23:16 2008年7月22日23时16分
Thanks!谢谢! Your solution worked fine for me!您的解决方案工作的罚款,我! Appreciate all the help!感谢所有帮助!