使用R中的数据库池RJDBC连接到数据库



我正试图使用pool连接到R中的数据库,但我得到了错误:

Schema must be specified when session schema is not set

如何指定模式?我似乎需要在游泳池中指定它。如果是这样的话,模式的参数名称是什么?

pool <- dbPool(
drv = RJDBC::JDBC(
"xxx",
"dir_to_jar", "`"
),
dbname = "db",
schema = "schema" # this didn't work
url = url,
user = user,
password = password,
SSL = 'true'
)
pool %>% tbl("schema.table")

我尝试了其他几种使用DBI::dbConnectId的方法,并且成功了:

pool <- DBI::dbConnect(
drv = RJDBC::JDBC(
"xxx",
"dir_to_jar", "`"
),
url = url,
user = user,
password = password,
SSL = 'true'
)
# Didn't work
pool %>% tbl(dbplyr::in_schema("catalog.schema", "table"))
# Works!
s <- Id(catalog = "catalog", schema = "schema", table = "table")
df <- dbReadTable(pool, s)

相关内容

  • 没有找到相关文章

最新更新