天天看點

如何解決sql連接配接錯誤HResult 0x2, Level 16, State 1 Could not open a connection to SQL Server [2].

HResult 0x2, Level 16, State 1

Named Pipes Provider: Could not open a connection to SQL Server [2].

Error: Microsoft SQL Native Client : 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..

Error: Microsoft SQL Native Client : Login timeout expired.

在使用 sqlcmd試圖連接配接本機資料庫的時候出現以上錯誤,已經檢查了以下情況:

1. sqlserver服務已開啟

2. sqlserver browser已開啟

3. TCP/IP 和 Named Pipes protocol 均開啟

4. sql area configuration允許本地和遠端連接配接

5. 防火牆1433端口準許連接配接

修改設定後已經重新開機sql服務,仍然得到以上錯誤