使用 64 位 R 从 32 位 Access db 读取数据 [英] Reading data from 32-bit Access db using 64-bit R

查看:37
本文介绍了使用 64 位 R 从 32 位 Access db 读取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

系统规格:64 位操作系统 (Win7)、64 位 R (3.3.3)、32 位 MS Access (2016).

System specs: 64-bit OS (Win7), 64-bit R (3.3.3), 32-bit MS Access (2016).

我在 32 位 .accdb 文件中有数据,我想将其读入 R.我试过这个:

I have data in a 32-bit .accdb file and I want to read it into R. I tried this:

con <- odbc::dbConnect(odbc::odbc(),
                       dsn="MS Access Database")

但看到以下错误:

Error: nanodbc/nanodbc.cpp:950: IM014: [Microsoft][ODBC Driver Manager] 
The specified DSN contains an architecture mismatch between the Driver and Application 

网络搜索表明R和数据库之间的位差异是罪魁祸首.Windows 中的默认 ODBC 管理器不包含 MS Access 的驱动程序(或者更确切地说,它似乎包含,但尝试使用该工具管理它们会导致架构错误).根据其他建议,我使用 32 位程序的 ODBC 管理器 (c:windowssysWOW64odbcad32.exe) 为 MS Access 文件创建了一个新名称的新 DSN,然后调用了这个 DSN:

Web search indicated that the bit difference between R and the database is the culprit. The default ODBC manager in Windows doesn't include drivers for MS Access (or rather, it seems to, but attempting to manage them using that tool gives you an architecture error). Following other advice, I used the ODBC manager for 32-bit programs (c:windowssysWOW64odbcad32.exe) to create a new DSN with a new name for MS Access files, and then called this DSN:

con <- odbc::dbConnect(odbc::odbc(),
                       dsn="MSAccess32")

但是,我遇到了同样的错误,并且怀疑我不明白此错误的含义.该问题是否有已知的解决方法?

I got the same error, however, and suspect there is something I don't understand about what this error means. Is there a known workaround for the problem?

推荐答案

访问文件本身对位数一无所知,只知道客户端应用程序和 odbc 驱动程序的位数:

The access file itself knows nothing about bitness, its only about the client application and the bitness of the odbc driver:

如果您的 R 是 64 位,则需要 64 位 ODBC 驱动程序进行访问,因此也使用 64 位的 odbc 管理器,即 C:WindowsSystem32odbcad32.exe(在 Win764位).

If your R is 64 bit, you need the 64bit ODBC driver for access and therefore also use the odbc manager for 64bit, which is C:WindowsSystem32odbcad32.exe (in Win7 64bit).

如果您的 R 是 32 位,则需要 32 位 ODBC 驱动程序,位于 C:WindowsSysWOW64odbcad32.exe.

While if your R is 32bit, you need the 32bit ODBC driver, located at C:WindowsSysWOW64odbcad32.exe.

您可以从这里下载所需的 Access Database Engine 2010 Redistributable:https://www.microsoft.com/en-US/download/details.aspx?id=13255

You can download the required Access Database Engine 2010 Redistributable from here: https://www.microsoft.com/en-US/download/details.aspx?id=13255

因此,下载 64 位 Access Database 驱动程序,创建一个 64 位 DSN 条目,您应该没问题.

So, download the 64 bit Access Database driver, create a 64bit DSN entry and you should be fine.

这篇关于使用 64 位 R 从 32 位 Access db 读取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆