1

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)?

user3507584
  • 3,246
  • 5
  • 42
  • 66

1 Answers1

1

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.

user3507584
  • 3,246
  • 5
  • 42
  • 66
  • 1
    The issue seems to be with the `RPostgreSQL` package's call to the underlying libpq library functions. See https://stackoverflow.com/a/64614787/11826257 and https://www.postgresql.org/docs/current/libpq.html. The other Stackoverflow thread is from 2020 but I still can't connect using `RPostgreSQL` version 0.7.5. Calling `library("RPostgres")` should be sufficient as this package is more up to date. – Snoeren01 Apr 17 '23 at 10:30