我正在尝试使用RODBC和DPLYR连接到SQL db,如下所示:
library(RODBC)
library(dplyr)
print("Attempting Connection")
data_odbc <- odbcDriverConnect('DRIVER={ODBC Driver 13 for SQL Server};
SERVER=localServer12;
DATABASE=testDB;
UID=user1;
PWD=pwd;
Trusted_Connection=yes')
print("Connection Established")
src_tbls(data_odbc)
close(data_odbc)
print("Connection Closed")
然而,当我运行这个R脚本时,我得到以下错误:
Error in UseMethod("src_tbls") :
no applicable method for 'src_tbls' applied to an object of class "RODBC"
我该如何解决这个问题?
-Thanks。