R与SQL服务器2016年错误“[Microsoft] [ODBC驱动程序管理器]数据源名称未找到并且没有指定默认驱动程序”
问题描述:
我试图连接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驱动程序。
答
也许你应该在你的[R WD创建一个txt文件,并保存在连接字符串中之后,你应该使用readlines方法(“您的连接string.txt”)来读取连接字符串 并在代码 使用为我工作..... 仅供参考,你应该禁用阻止R从你的Windows防火墙与高级安全....
答
进入相同的消息...它看起来像它只是一个来自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.
你[搜索您的错误(https://stackoverflow.com/search?q=Data+source+name+not+found+and+no+default+driver+specified+ [R]) ? – halfer
您使用什么版本的R客户端连接到SQL Server?您是否试图将计算推送到R客户端的SQL Server 2016 R服务中? – Minu