2012-11-15 40 views
1

我試圖創建ODBC連接到SQL Server,但是當我做,我得到錯誤:診斷連接到SQL Server

Connection failed: 
SQLState: '01000' 
SQL Server Error: 10060 
[Microsoft][ODBC_SQL Server Driver][TCP/IP Sockets] COnnectionOpen (Connect()). 
Connection failed: 
SQLState: '08001' 
SQL Server Error: 17 
[Microsoft][ODBC_SQL Server Driver][TCP/IP Sockets] SQL Server does not exist or access denied. 

這是我已經試過:

  1. 不是防火牆問題:關閉SQL Server上的防火牆並嘗試關閉客戶端。也能夠從客戶端telnet 1433,工作正常。
  2. 不是一個訪問問題:我可以從許多不同的計算機登錄,包括使用我在客戶端上使用的帳戶的SQL Server本身(使用SQL Server身份驗證)
  3. 我可以ping主機名和IP地址。 (我用盡全力)

我能想到的唯一的事情是,客戶端計算機的Windows Server 2003,並具有各種角色的設置:

  • 文件服務器
  • 應用服務器
  • 終端服務器
  • 域控制器
  • DNS服務器

我不知道爲什麼要設置這些服務,但目前我無法關閉它們。它會是其中的任何一種嗎?如果是這樣,是否有辦法禁用它們的任何方面,這可能會阻止SQL。

任何意見真正讚賞!

+0

另一件事:我能夠從其他客戶端罰款創建ODBC連接。看起來問題在於這個特定的客戶端,無論是與角色設置,還是其他的東西。謝謝! – russds

回答

4

發現的問題。由於某種原因,即使客戶端上沒有使用SQL,它也已安裝,並且轉到所有程序 - > Microsoft SQL Server - >客戶端網絡實用程序,我發現協議TCP/IP正在使用端口4717.我不知道爲什麼這個端口被使用,甚至更進一步,我不知道爲什麼它甚至很重要 - 我只是建立了一個odbc連接,並且根本不使用sql server(在客戶端上)。無論哪種方式,我將它改爲典型的端口(1433),並且像繁榮一樣,ODBC連接就像魅力一樣起作用!

0

是否有可能有問題的服務器尚未配置爲使用命名管道?

CAUSE
The most common reason that this connection attempt failed is that this DSN or ODBC data source attempted to make a connection using the TCP/IP sockets Net-Library, which is Dbmssocn.dll. Because the SQL Server is not listening for incoming connections for TCP/IP sockets clients, the connection fails. From ISQL/w, the second error message stated above would be returned. The OS Error is 10061, and the function call that failed was ConnectionOpen(connect()).

WORKAROUND
By default, SQL Server will listen for incoming connections made by Named Pipes clients. Named Pipes is the default IPC mechanism for clients to connect to a SQL Server version 4.2, 6.0, and 6.5 server. The Named Pipes DLL is Dbnmpntw.dll, and it should be located in the Windows\System or Winnt\System32 directory. The TCP/IP sockets netlib DLL is Dbmssocn.dll, and also should be in the Windows\System or Winnt\System32 directory.The most common resolution to this problem is to configure the client computer to connect using Named Pipes. Configuring Named Pipes If the Microsoft Data Access Components (MDAC) ODBC drivers have been installed on the computer, you can make this change in the second step of the Create New Data Source wizard.

NOTE: You can download MDAC drivers from:

http://msdn2.microsoft.com/en-us/data/aa937730.aspx To configure the client, start the Create New Data Source wizard, click the Client Configuration button, and perform the following steps, based on the version of the SQL Server ODBC driver you are using:

For SQL Server ODBC Driver version 3.50

Click the Net Library tab and use the drop down list box to set the 
default network (Net Library) to Named Pipes. 
On the Advanced tab, remove any advanced entries that reference the 
server you are connecting to. 
Click Done. 

For SQL Server ODBC Driver version 3.70

In the Network Libraries section of the Edit Network Library Configuration 
dialog box, select Named Pipes. 
Click OK. 

If you do not have the MDAC ODBC drivers installed, you can use the SQL Server Client Configuration Utility tool to set the default Net-Library to Named Pipes. You can install the client utilities from the SQL Server CD from the i386 directory.

來源:http://support.microsoft.com/kb/195566

+0

嗯,我試圖使用TCP/IP,這是我們通常如何設置到這個數據庫的ODBC連接。不過謝謝。 – russds

0

默認情況下,SQL Native Client似乎查找MSSQLSERVER實例。但是,如果您使用SQLEXPRESS,則所有連接都將失敗。

很奇怪,但嘗試MSSQLSERVER實例名稱安裝的SQL Server - 它應該工作!

0

要創建新的數據源到SQL Server,請執行下列操作步驟:

  1. 在主機/服務器到SQL Server管理套件 - >打開保衛科的左手 - >右鍵單擊Login,選擇New Login,然後爲要連接的數據庫創建一個新帳戶。

  2. 檢查TCP/IP協議是否啓用。轉到所有程序 - > Microsoft SQL Server 2008 - >配置工具 - >打開Sql server配置管理器。在左側選擇客戶端協議(基於您的操作系統32/64位)。在右邊,檢查TCP/IP協議是否啓用。

  3. 在遠程計算機/服務器中,打開數據源管理員。控制面板 - >管理工具 - >數據源(ODBC)。

  4. 在用戶DSN或系統DSN中,單擊添加按鈕並選擇Sql Server驅動程序,然後按完成。

  5. 輸入名稱。

  6. 輸入服務器,請注意:如果您想輸入主機地址,則應該輸入不含「\\」的IP地址。例如。 192.168.1.5並按下一步。

  7. 選擇使用SQL Server身份驗證,使用用戶輸入的登錄ID和密碼。

  8. 在下面輸入您在第一步創建的登錄ID和密碼。然後單擊下一步。

  9. 如果顯示數據庫是您的數據庫,請單擊下一步,然後單擊完成。