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數據庫的連接
- Oracle EXP-00091 Error When Export Database甲骨文進出口- 00091時發生錯誤,進出口數據庫
- Workaround for Remote Desktop Client to Connect to Localhost (Local Terminal Server Service)可行的遠程桌面客戶端連接到本地(本地終端服務器服務)































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!感謝所有幫助!