2

I am trying to connect to my localhost Postgres DB within R to further read/write tables. The server is running in the background which I'm monitoring in the background. I'm using the RPostgreSQL library.

pg <- dbDriver(drvName = "PostgreSQL")
    
con <- dbConnect(drv = pg, dbname = "test", 
                 host = "localhost", 
                 port = 5432, 
                 user = "postgres", 
                 password = "1234")

dbListTables(con)

Just running the dbConnect part gives a strange message reading:

ØJI)

Further running the dbListTables function gives:

Error in h(simpleError(msg, call)) : 
  error in evaluating the argument 'conn' in selecting a method for function 'dbWriteTable': object 'con' not found

I can't figure out what I am missing.

Edit: I think I'm not using the RPostgreSQL library correctly. Using RPostgres worked perfectly now.

Coon
  • 87
  • 7
  • 2
    This is interesting, as it seems to be the first I've seen where `RPostgres` and `RPostgreSQL` differ at connection-attempt. Glad it's working for you with the `RPostgres` package. – r2evans Dec 20 '21 at 01:20
  • Same here, Windows 11, PostgreSQL 14, with ```RPostgres``` no problems https://CRAN.R-project.org/package=RPostgres with ```RPostgreSQL``` the strange error ·°]) – ckluss Mar 26 '22 at 19:15

0 Answers0