RPostgreSQL - 尝试连接到本地数据库时出现 SCRAM 错误

问题描述 投票:0回答:2

我正在尝试连接到我的本地主机 postgres 数据库,但出现以下错误。

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

它似乎与身份验证安全性有关,但我有一个本地数据库..有什么方法可以在 pgAdmin 4 中执行任何操作并避免此错误(即使它不太安全)?

r postgresql rpostgresql
2个回答
3
投票

令人惊讶的是我设法使用其他软件包进行连接

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

这里有一个很好的解释和演练。


0
投票

library("RPostgres") library(DBI) # Connect to postgres database con <- DBI::dbConnect(RPostgres::Postgres(), dbname = dbname, host = host, port = port, user = user, password = rstudioapi::askForSecret("password")) ## Get a list of tables in the database dbListTables(con)

© www.soinside.com 2019 - 2024. All rights reserved.