【发布时间】:2019-07-14 01:46:15
【问题描述】:
我正在尝试使用 DBI 和 RPostgres 从 Rstudio 连接到外部数据库 (PostgresSQL)。我定义了所有参数:
con <- DBI::dbConnect(RPostgres::Postgres(),
dbname = 'name',
host = 'http://bi-warehouse.cngdka9w0zww.us-east-1.rds.amazonaws.com/',
port = 5432,
user = 'user',
password = 'passwd')
但仍然出现错误:
Error in connection_create(names(opts), as.vector(opts)) :
could not translate host name "http://bi-warehouse.cngdka9w0zww.us-east-1.rds.amazonaws.com/" to address: Name or service not known
【问题讨论】:
-
http 不是数据库协议;)您必须删除错误信息;)
-
所以,主机参数只有:bi-warehouse.cngdka9w0zww.us-east-1.rds.amazonaws.com/
-
现在我得到了以下信息:
Error in connection_create(names(opts), as.vector(opts)) : could not connect to server: No route to host Is the server running on host "bi-warehouse.cngdka9w0zww.us-east-1.rds.amazonaws.com" (10.0.1.103) and accepting TCP/IP connections on port 5432? -
在没有交易斜线的情况下,这不是网站的路线 :) 它只是您安装 postgreSQL 的服务器(主机)的域,您是否检查过,您的 postgreSQL 可以是从外部系统连接,默认只允许本地连接。
标签: rstudio dbi rpostgresql