我正在尝试将我的 Sequel Pro 数据库连接到 R。在 Joseph Adler 的“R in a Nutshell” - 第 164 页 - 他列出了不同数据库的各种 ODBC 驱动程序,但我找不到 Sequel Pro 的驱动程序。任何有关使用哪个驱动程序的帮助将不胜感激。
问问题
1852 次
1 回答
1
我没有 Sequel Pro 数据库,但您可能会遵循以下步骤:
- 安装正确的 ODBC 驱动程序 (http://dev.mysql.com/downloads/connector/odbc/)
- 将数据库添加为 ODBC DSN。这在 Windows 中的管理工具 -> 数据源 (ODBC) 中可用。(通过右键单击“开始”菜单“自定义...”来启用,然后选择“系统管理工具”下的显示选项之一。)在“文件 DSN”(最有可能)或“用户 DSN”下添加数据库。
使用 R 打开 ODBC 连接:
library(RODBC) dsn <- "this is the dsn assigned in the windows tool" db <- odbcConnect(dsn) sqlQuery(db, "select * from whatever") sqlSave(db, df)
中的数据df
。对不起,我不能给你确切的过程,但我没有必要的数据。
于 2012-03-31T03:56:27.980 回答