2016-04-16 46 views
0

我試圖連接R與SQL服務器2016年,當我嘗試RevoScaleR_SqlServer_GettingStarted.R腳本或我自己的腳本I得到以下錯誤:R與SQL服務器2016年錯誤「[Microsoft] [ODBC驅動程序管理器]數據源名稱未找到並且沒有指定默認驅動程序」

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified ODBC Error in SQLDisconnect Could not open data source. Error in doTryCatch(return(expr), name, parentenv, handler) : Could not open data source.

注意:我可以在SQL管理工作室中執行R腳本。我已經在ODBC數據源(64位)中爲SQL Server版本13.00.1300配置了Microsoft ODBC驅動程序。

+0

你[搜索您的錯誤(https://stackoverflow.com/search?q=Data+source+name+not+found+and+no+default+driver+specified+ [R]) ? – halfer

+0

您使用什麼版本的R客戶端連接到SQL Server?您是否試圖將計算推送到R客戶端的SQL Server 2016 R服務中? – Minu

回答

-1

也許你應該在你的[R WD創建一個txt文件,並保存在連接字符串中之後,你應該使用readlines方法(「您的連接string.txt」)來讀取連接字符串 並在代碼 使用爲我工作..... 僅供參考,你應該禁用阻止R從你的Windows防火牆與高級安全....

0

進入相同的消息...它看起來像它只是一個來自R的通用消息連接字符串有問題。

至少這是我的問題...示例代碼中有一個空間需要您的服務器實例名稱。刪除空間爲我固定。

# https://microsoft.github.io/sql-ml-tutorials/R/customerclustering/step/2.html 
#Connection string to connect to SQL Server. Don't forget to replace MyServer with the name of your SQL Server instance 

connStr <- paste("Driver=SQL Server;Server=", " localhost", ";Database=" , "tpcxbb_1gb" , ";Trusted_Connection=true;" , sep=""); # Broken... due to space in the paste. 
connStr <- paste("Driver=SQL Server;Server=", "localhost", ";Database=" , "tpcxbb_1gb" , ";Trusted_Connection=true;" , sep=""); #Fixed. 
相關問題