Skip to content

Error in connecting R to Postgre

7 messages · krisan haria, Edward Vanden Berghe, Dirk Eddelbuettel +1 more

#
Hi

I have the following version of R installed

R version 3.0.0

I'm trying to connect this to PostGre Version 1.16.1

I have loaded the package RPostgreSQL

I have then tried to run the following
<PostgreSQLDriver:(8568)>
Error in postgresqlNewConnection(drv, ...) :
  RS-DBI driver: (could not connect PLAYER at local on dbname "postgres"
)

Any idea on what is causing this error?
#
Sorry that is version PostgreSQL 9.2.4
On Mon, Sep 9, 2013 at 12:02 PM, krisan haria <krisanharia at gmail.com> wrote:

            

  
    
#
Hi Krisan,

Are you able to connect to the database using other tools - command line, pgAdmin?

Edward

-----Original Message-----
From: r-sig-db-bounces at r-project.org [mailto:r-sig-db-bounces at r-project.org] On Behalf Of krisan haria
Sent: 09 September 2013 13:02
To: R-sig-DB at r-project.org
Subject: [R-sig-DB] Error in connecting R to Postgre

Hi

I have the following version of R installed

R version 3.0.0

I'm trying to connect this to PostGre Version 1.16.1

I have loaded the package RPostgreSQL

I have then tried to run the following
<PostgreSQLDriver:(8568)>
Error in postgresqlNewConnection(drv, ...) :
  RS-DBI driver: (could not connect PLAYER at local on dbname "postgres"
)

Any idea on what is causing this error?

--
Dr. Krisan Haria


_______________________________________________
R-sig-DB mailing list -- R Special Interest Group R-sig-DB at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-db
#
Under pgAdmin yes. No issue there at all
On Mon, Sep 9, 2013 at 12:34 PM, Edward Vanden Berghe <evberghe at gmail.com>wrote:

            

  
    
#
Seems your user doesn???t have access. Did you get access with the same user and password through pgAdmin? Do you log connections to the database in postgresql.conf? If so, do you find anything in the PostgreSQL log file?

 

Edward

 

From: krisan haria [mailto:krisanharia at gmail.com] 
Sent: 09 September 2013 13:40
To: Edward Vanden Berghe
Cc: R-sig-DB at r-project.org
Subject: Re: [R-sig-DB] Error in connecting R to Postgre

 

Under pgAdmin yes. No issue there at all
On Mon, Sep 9, 2013 at 12:34 PM, Edward Vanden Berghe <evberghe at gmail.com> wrote:
Hi Krisan,

Are you able to connect to the database using other tools - command line, pgAdmin?

Edward


-----Original Message-----
From: r-sig-db-bounces at r-project.org [mailto:r-sig-db-bounces at r-project.org] On Behalf Of krisan haria
Sent: 09 September 2013 13:02
To: R-sig-DB at r-project.org
Subject: [R-sig-DB] Error in connecting R to Postgre

Hi

I have the following version of R installed

R version 3.0.0

I'm trying to connect this to PostGre Version 1.16.1

I have loaded the package RPostgreSQL

I have then tried to run the following
<PostgreSQLDriver:(8568)>
Error in postgresqlNewConnection(drv, ...) :
  RS-DBI driver: (could not connect PLAYER at local on dbname "postgres"
)

Any idea on what is causing this error?

--
Dr. Krisan Haria


_______________________________________________
R-sig-DB mailing list -- R Special Interest Group R-sig-DB at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-db
#
On 9 September 2013 at 14:57, Edward Vanden Berghe wrote:
| Seems your user doesn?t have access. Did you get access with the same user and password through pgAdmin? Do you log connections to the database in postgresql.conf? If so, do you find anything in the PostgreSQL log file?

Also:
 
 -- what OS is this hosted on?

 -- are you connecting via the network, or on the same machine?

 -- RPostgreSQL "behaves like psql" in the sense that you MUST provide tcp/ip
    access to PostgreSQL whereas the other apps may use other means

 -- hence make sure you can, say, connect with psql from another box after
    which RPostgreSQL will work too.

These are not R-related questions. Check the PostgreSQL documentation for
'enable network access' etc.

Dirk

  
 
| Edward
| 
|  
| 
| From: krisan haria [mailto:krisanharia at gmail.com] 
| Sent: 09 September 2013 13:40
| To: Edward Vanden Berghe
| Cc: R-sig-DB at r-project.org
| Subject: Re: [R-sig-DB] Error in connecting R to Postgre
| 
|  
| 
| Under pgAdmin yes. No issue there at all
| 
|  
|
| On Mon, Sep 9, 2013 at 12:34 PM, Edward Vanden Berghe <evberghe at gmail.com> wrote:
| 
| Hi Krisan,
| 
| Are you able to connect to the database using other tools - command line, pgAdmin?
| 
| Edward
| 
| 
| -----Original Message-----
| From: r-sig-db-bounces at r-project.org [mailto:r-sig-db-bounces at r-project.org] On Behalf Of krisan haria
| Sent: 09 September 2013 13:02
| To: R-sig-DB at r-project.org
| Subject: [R-sig-DB] Error in connecting R to Postgre
| 
| Hi
| 
| I have the following version of R installed
| 
| R version 3.0.0
| 
| I'm trying to connect this to PostGre Version 1.16.1
| 
| I have loaded the package RPostgreSQL
| 
| I have then tried to run the following
| 
| > drv <- dbDriver("PostgreSQL")
| > drv
| <PostgreSQLDriver:(8568)>
| > con <- dbConnect(drv, dbname="postgres")
| Error in postgresqlNewConnection(drv, ...) :
|   RS-DBI driver: (could not connect PLAYER at local on dbname "postgres"
| )
| 
| Any idea on what is causing this error?
| 
| --
| Dr. Krisan Haria
| 
|         [[alternative HTML version deleted]]
| 
| _______________________________________________
| R-sig-DB mailing list -- R Special Interest Group R-sig-DB at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-db
| 
| 
| 
| 
| -- 
| Dr. Krisan Haria
| 
| 
| 	[[alternative HTML version deleted]]
| 
| 
| ----------------------------------------------------------------------
| _______________________________________________
| R-sig-DB mailing list -- R Special Interest Group
| R-sig-DB at r-project.org
| https://stat.ethz.ch/mailman/listinfo/r-sig-db
#
Hi,

While Dirk is right in that psql and RPostgreSQL should behave the same,
both psql and RPostgreSQL should be able to connect via unix domain socket.

In this case, what you are trying is equivalent to

psql -U PLAYER postgres
(on the host you are running R)

Does this work?

Best regards,