简体   繁体   English

使用R连接到PostgreSQL(在Windows中)

[英]Connect to PostgreSQL using R (in windows)

I have this R code and i want to connect to a postgres db using the conf file: 我有这个R代码,我想使用conf文件连接到postgres数据库:

con <- dbConnect(PostgreSQL(), groups='epl')

The postgresql.conf file contains: postgresql.conf文件包含:

#------------------------------------------------------------------------------
# CUSTOMIZED OPTIONS
#------------------------------------------------------------------------------

# Add settings for extensions here
[epl]
host='localhost'
port = 5432
dbname='rlearning'
user='user'
password='pass'

When I run the R code, i get this error: 当我运行R代码时,我收到此错误:

Error in postgresqlNewConnection(drv, ...) : 
  unused argument(s) (groups = "epl")

If everything else fails, you can try reading the documentation and following the examples. 如果其他一切都失败了,您可以尝试阅读文档并按照示例进行操作。 For help(dbConnect) , you find 您可以找到help(dbConnect)

# create an PostgreSQL instance and create one connection.
drv <- dbDriver("PostgreSQL")

# open the connection using user, passsword, etc., as
con <- dbConnect(drv, dbname = "postgres")

and this is where you add additional user, password, host, arguments. 这是您添加其他用户,密码,主机,参数的地方。

It will also show you that there is no argument groups explaining the error you get. 它还将向您显示没有参数groups解释您得到的错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM