Ariel
Ariel

Reputation: 153

Connect to a PostgreSQL database in a Server from a local machine R

When you connect to PostgreSQL thorough RPostgreSQL for example I do the following.

m <- dbDriver("PostgreSQL")
con <- dbConnect(m, host = "localhost", user= "postgres", password="admin", 
dbname = "postgres")

But if you want to connect to a postgreSQL in a Server, I'm not sure how to do it. I'd do the following:

m <- dbDriver("PostgreSQL")
con <- dbConnect(m, host = "10.100.100.10", port = "5432", user= "postgres", 
                 password="admin", dbname = "postgres")

and this gives me this error:

Error in postgresqlNewConnection(drv, ...) : RS-DBI driver: (could not connect [email protected] on dbname "postgres"

Upvotes: 0

Views: 2138

Answers (1)

Dirk is no longer here
Dirk is no longer here

Reputation: 368181

You (or whoever admins the server) needs to allow access from another machine over tcp/ip -- this is turned off by default. See for example

Upvotes: 3

Related Questions