所以我有一些問題試圖連接到我的網絡上託管的服務器,但在我嘗試運行的程序的另一臺計算機上。我檢查了兩臺電腦都在同一個域中。我使用python編碼並使用PYODBC進行連接。 的連接線如下:無法連接到在Python 7上使用PYODBC在Windows 7上的遠程MS SQL服務器
connectLine = 'DRIVER={SQL Native Client};SERVER='+configValues['host']+';DATABASE='+configValues['db']+';UID='+configValues['user']+';PWD='+configValues['passwd']
db = pyodbc.connect(connectLine)
現在,當服務器是相同的計算機程序上的作品,但是當我嘗試連接到服務器我的實際服務器上它不工作。我在Windows SBS 2003上運行MicrosoftSQL Express 2005,運行該程序的計算機運行的是Windows 7,並使用Python 2.7編碼的程序。
這是程序的輸出,我打印了連接線。
DRIVER={SQL Native Client};SERVER=192.168.1.103\OSBORNE;DATABASE=vpmser;UID=massEmailer;PWD=cogbutfeswas5836;
Traceback (most recent call last):
File "E:\Mass Emailer\massEmailer.py", line 56, in <module>
db = pyodbc.connect(connectLine)
Error: ('08001', '[08001] [Microsoft][SQL Native Client]SQL Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF]. (-1) (SQLDriverConnectW); [HYT00] [Microsoft][SQL Native Client]Login timeout expired (0); [08001] [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. (-1)')
在連接字符串中有4個內容未知的變量,並且你沒有說出你得到了什麼錯誤信息,也沒有提供回溯 - 這不可能引出有意義的答案。 – 2010-12-09 06:35:17