0

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 postgres@10.100.100.10 on dbname "postgres"

Ariel
  • 157
  • 1
  • 4
  • 18

1 Answers1

3

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

Community
  • 1
  • 1
Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
  • 1
    thanks , though I think the access is open because I have postgreSQL in my local machine and I can connect to the database in the server using pgAdmin. The problem is in R where it only listen the host as a localhost. – Ariel Aug 04 '15 at 14:38