Unable to connect PostgreSQL to R Studio Due to "R Session Aborted" Error

install.packaged('RPostgreSQL')
library(RPostgreSQL)

pw <- {
  "my password"
}
drv <- dbDriver("PostgreSQL")
con <- dbConnect(drv, dbname = "learning",
                 host = "localhost", port = 5432,
                 user = "postgres", password = pw)
rm(pw) 

Hello everyone,

When I try to connect PostgreSQL to R Studio using 'RPosgreSQL' package, I keep getting 'R Session Aborted: R encountered a fatal error. The session was terminated' error.

Above is the code I used. I ran each command separately and I found out that 'dbConnect' function always causes this error. (Installing & loading & 'dbDriver' function works just fine). I checked dbname & user by using 'current.database()' & 'current.user()' command, so I believe they are correct and I also confirmed that port# is '5432'.

I have done some research, but I was not able to find good solutions and anyone who is going through the same issue, so any help would be much appreciated...

Thank you very much.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.