我在使用 RStudio 上的 R 和使用包 RPostgreSQL 连接到我的 Amazon RDS PostgreSQL 数据库时遇到问题。
我在跑步:
library("RPostgreSQL")
drv <- dbDriver("PostgreSQL")
con <- dbConnect(drv, dbname="mydbname",
host="........us-west-2.rds.amazonaws.com", port=5432,
user="myuser", password="mypassword")
运行此行后,我收到错误:
postgresqlNewConnection(drv, ...) 中的错误:RS-DBI 驱动程序:(无法在 dbname "mydbname" 上连接 myuser@.........us-west-2.rds.amazonaws.com)
请注意,我有正确的 dbname、主机、端口、用户和密码,因为我能够使用 pgAdmin3 连接到 Amazon 数据库
这是我的会话信息:
R version 3.3.0 (2016-05-03)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.11.5 (El Capitan)
locale:
[1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] RPostgreSQL_0.4-1 DBI_0.4-1 dplyr_0.4.3 knitr_1.13 rbokeh_0.4.2
[6] miniUI_0.1.1 shiny_0.13.2
loaded via a namespace (and not attached):
[1] Rcpp_0.12.5 formatR_1.4 highr_0.6 pryr_0.1.2
[5] plyr_1.8.4 tools_3.3.0 digest_0.6.9 jsonlite_0.9.22
[9] evaluate_0.9 gtable_0.2.0 lattice_0.20-33 datasummary_0.2.0
[13] yaml_2.1.13 parallel_3.3.0 hexbin_1.27.1 httr_1.2.0
[17] stringr_1.0.0 htmlwidgets_0.6 DistributionUtils_0.5-1 maps_3.1.0
[21] packagedocs_0.3.6 grid_3.3.0 DT_0.1.56 R6_2.1.2
[25] rmarkdown_0.9.6.14 ggplot2_2.1.0 gistr_0.3.6 magrittr_1.5
[29] whisker_0.3-2 scales_0.4.0 codetools_0.2-14 htmltools_0.3.5
[33] lazyrmd_0.1.0 assertthat_0.1 xtable_1.8-2 mime_0.4
[37] colorspace_1.2-6 httpuv_1.3.3 stringi_1.1.1 lazyeval_0.2.0
[41] munsell_0.4.3