【发布时间】:2015-11-12 23:04:44
【问题描述】:
我正在尝试使用 R 连接到 SQL Sever 数据库,但不确定查询字符串的详细信息。我通常在 SQL Server 2008 上使用 SQL Server Management Studio,并使用单点登录进行连接。我找到了下面的例子
myconn <- odbcDriverConnect(connection="Driver={SQL Server
Native Client 11.0};server=hostname;database=TPCH;
trusted_connection=yes;")
我收到以下警告消息
Warning messages:
1: In odbcDriverConnect(connection = "Driver={SQL Server \nNative Client 11.0};server=hostname;database=TPCH;\ntrusted_connection=yes;") :
[RODBC] ERROR: state IM002, code 0, message [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
2: In odbcDriverConnect(connection = "Driver={SQL Server \nNative Client 11.0};server=hostname;database=TPCH;\ntrusted_connection=yes;") :
ODBC connection failed
如何找到我需要的细节?
【问题讨论】:
-
我认为您只需要“SQL Server”作为您的驱动程序。这就是我用来连接 SQL Server 2012 的全部内容。
-
我认为你已经(在你的实际实现中)用你的实际主机名替换了 server=hostname 中的主机名....\
标签: sql-server r rodbc