RPostgreSQL - SCRAM error when trying to connect to local database

1.1k Views Asked by At

I am trying to connect to my localhost postgres DB and I get the following error.

library("RPostgreSQL")
drv <- dbDriver("PostgreSQL")
connec <- dbConnect(drv, dbname = "dbnamehere", port = 5432,user = "some_username", password = "somepassword")


Error in postgresqlNewConnection(drv, ...) : 
  RPosgreSQL error: could not connect admin_sci4i@localhost:5432 on dbname "website": SCRAM authentication requires libpq version 10 or above

It seems related to authentication security but I am having a local DB.. Is there any way to do anything in pgAdmin 4 and avoid this error (even if it is less secure)?

1

There are 1 best solutions below

1
User981636 On BEST ANSWER

Surprisingly I managed to connect using other packages

library("RODBC")
library("odbc")
library("RPostgres")
con <- dbCanConnect(RPostgres::Postgres(),dbname="dbnamehere",port = 5432,user = "some_username", password = "somepassword")
con # Checks connection is working
con1 = dbConnect(RPostgres::Postgres(),dbname="dbnamehere",port = 5432,user = "some_username", password = "somepassword")
con1 # Checks connect
dbListTables(con1) # See tables

A nice explanation and walkthrough here.