我在RStudio上使用R并使用软件包RPostgreSQL连接到我的Amazon RDS PostgreSQL数据库时遇到问题。
I am having trouble connecting to my Amazon RDS PostgreSQL database using R on RStudio and using the package RPostgreSQL.
我正在运行:
library("RPostgreSQL") drv <- dbDriver("PostgreSQL") con <- dbConnect(drv, dbname="mydbname", host="........us-west-2.rds.amazonaws", port=5432, user="myuser", password="mypassword")运行此行后,出现错误:
After running this line, I get the error:
postgresqlNewConnection(drv,...)中的错误:RS-DBI驱动程序:(是否无法连接 myuser @。 ....... us-west-2.rds.amazonaws在 dbname mydbname上)
Error in postgresqlNewConnection(drv, ...) : RS-DBI driver: (could not connect myuser@.........us-west-2.rds.amazonaws on dbname "mydbname" )
请注意,我具有正确的dbname,主机,端口,用户和密码,因为我能够使用pgAdmin3连接到Amazon数据库
Note that I have the correct dbname, host, port, user and password because I am able to connect to the Amazon database using pgAdmin3
这是我的会话信息:
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推荐答案
尝试使用 RPostgres 包进行连接,它对我有用。查看详情此处
try to connect using RPostgres package, it worked for me. See details here
更多推荐
无法使用RPostgreSQL连接到R上的Amazon PostgreSQL RDS数据库
发布评论