[R] Error using RPostgreSQL

Tom Wright tom at maladmin.com
Fri Apr 22 16:28:23 CEST 2016


On heroku the database uri is stored in an environment variable.

> db_uri = Sys.getenv(''DATABASE_URL')

I'm not sure if you can use that directly or if you will need to parse
it for username, password etc.

On Thu, 2016-04-21 at 16:49 +0100, Izaak Rogan wrote:
> Hi,
> 
> I'm having trouble connecting to my postgreSQL db on Heroku(Amazon)
> using RPostgreSQL.
> 
> I've looked through GitHub for people doing the same thing. There are
> quite a few examples and all look similar to the below:
> 
> drv <- dbDriver("PostgreSQL")
> 
> con <- dbConnect(
>           drv,
>           dbname = "dadqn30er7ghpl",
>           host = "ec2-27-837-167-90.eu-west-1.compute.amazonaws.com",
>           port = 5432,
>           user = "tascofyvasswmblc",
>           password = XXXXXX'
> );
> 
> I'm getting the error:
> 
> Error in postgresqlNewConnection(drv, ...) :
>   RS-DBI driver: (could not connect
> tascofyvasswmblc at ec2-27-837-167-90.eu-west-1.compute.amazonaws.com on
> dbname "dascn90er7ghpl"
> )
> 
> Any pointers would be hugely appreciated!
> 
> Thanks,
> Izaak
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list