dbConnect to Postgres gives strange error not allowing me to connect

430 Views Asked by At

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.

0

There are 0 best solutions below