如何在OSX 10.10.2上将R与PostgreSQL连接? [英] How to connect R with PostgreSQL on OSX 10.10.2?
问题描述
我有以下设置:
- OSX 10.10.2
- PostgreSQL 9.4.1
- R 3.1.3
截至2011年的答案说,最简单的方法是使用 RpgSQL
程序包。但这已从CRAN存储库中已删除。 RODBC
提到有源,但无法配置:
This answer as of 2011 says that the easiest approach is to use RpgSQL
package. But it is removed from the CRAN repository. RODBC
mentioned there is available as source, but it fails to configure:
configure: error: "ODBC headers sql.h and sqlext.h not found"
ERROR: configuration failed for package ‘RODBC’
我也找到了另一个可以帮助我的软件包- RPostgreSQL
,但无法编译:
I've also found another package, which could help me - RPostgreSQL
, but it fails to compile:
In file included from RS-PQescape.c:7:
./RS-PostgreSQL.h:23:14: fatal error: 'libpq-fe.h' file not found
# include "libpq-fe.h"
^
1 error generated.
make: *** [RS-PQescape.o] Error 1
ERROR: compilation failed for package ‘RPostgreSQL’
还有其他方法可以连接R和PostgreSQL吗?
Is there any other way to connect R and PostgreSQL?
推荐答案
请参见 RODBC连接到Mavericks上的SQL Server
RODBC在OSX上实际上不受支持。
我最终要做的是使用CRAN中的RJDBC。
设置与数据库的连接并不总是那么容易。但这可以做到:
Postgres DB无法连接使用RJDBC到R
RODBC isn't really supported on OSX.
What I ended up doing is to use RJDBC, which is in CRAN.
Setting up the connection to your data base isn't always easy. But it can be done:
Postgres DB can't connect to R with RJDBC
这篇关于如何在OSX 10.10.2上将R与PostgreSQL连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!