我正在尝试连接和MS Access数据库到R并创建一个数据帧并最终绘制一些数据,但我得到此错误,而我似乎正在从表中正确导入数据。问题在哪里?
控制台:
> # Load RODBC package
> library(RODBC)
>
> # Connect to Access db
> db_address <- "S:/LKF/Interdepartmental/DataGovernance/Tools/MM_Backend.accdb"
> db <- odbcConnectAccess(db_address)
Error in odbcConnectAccess(db_address) :
odbcConnectAccess is only usable with 32-bit Windows
>
>
> # Get data
> sql <- "select * from tblMaterials"
> df1 <- sqlQuery( db , sql)
Error in sqlQuery(db, sql) : first argument is not an open RODBC channel
代码:
# Load RODBC package
library (RODBC)
# Connect to Access db
db_address <- "S:/LKF/Interdepartmental/DataGovernance/Tools/MM_Backend.accdb"
db <- odbcConnectAccess(db_address)
# Get data
sql <- "select * from tblMaterials"
df1 <- sqlQuery( db , sql)
答案 0 :(得分:0)
我用这篇文章想出来了:this recently published issue
我有一个64位的窗口,我的办公室产品都是32位,因此我必须将R-32位作为默认值并更改连接定义:
odbcDriverConnect("Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=S:/LKF/Interdepartmental/DataGovernance/Tools/MM_Backend.accdb")