从R studios连接到SQL Server:“错误:nanodbc/nanodbc.cpp:983:00000:[unixODBC][Driver Manager]无法打开库'driver':未找到文件”

ax6ht2ek  于 11个月前  发布在  iOS
关注(0)|答案(2)|浏览(104)

我正在尝试从Rstudio连接到SQL Server。我得到以下错误。

> odbc::odbcListDrivers() 
                           name   attribute                                   value
1 ODBC Driver 13 for SQL Server Description Microsoft ODBC Driver 13 for SQL Server
2 ODBC Driver 13 for SQL Server      Driver    /usr/local/lib/libmsodbcsql.13.dylib
3 ODBC Driver 13 for SQL Server  UsageCount    

library(odbc)
con <- DBI::dbConnect(odbc::odbc(),
                  Driver = "ODBC Driver 13 for SQL",
                  Server = "130.440.220.502",
                  Database = "CI_Temp",
                  UID = "user_x",
                  PWD = rstudioapi::askForPassword("Database password"),
                  Port = 1433)

Error: nanodbc/nanodbc.cpp:983: 00000: [unixODBC][Driver Manager]Can't open lib 'driver' : file not found

字符串
任何帮助将不胜感激。提前致谢

xxls0lw8

xxls0lw81#

您需要使用Driver =“ODBC Driver 13 for SQL Server”

library(odbc)
con <- DBI::dbConnect(odbc::odbc(),
                  Driver = "ODBC Driver 13 for SQL Server",
                  Server = "130.440.220.502",
                  Database = "CI_Temp",
                  UID = "user_x",
                  PWD = rstudioapi::askForPassword("Database password"),
                  Port = 1433)

字符串

alen0pnh

alen0pnh2#

我用Driver = "SQL Server",它对我有用。

相关问题