SparkR - read.jdbc - 错误:jdbc中的错误:当尝试从PostgreSQL数据库读取时,参数的长度为零

时间:2018-06-02 01:49:47

标签: r postgresql sparkr

我正在尝试使用来自Rstudio的PostgreSQL包从外部SparkR数据库中读取数据,但继续获取参数的错误长度为零。以下是我的代码:

# set db variables
jdbcUrl = "jdbc:postgresql://db.host.url:5432/db_name"
username = "db_username"
pw = "db_password"

# define query
df_column_names <- c("id", "date", "datetime", "address", "name")

df_query <- sprintf("SELECT %s FROM schema.table_name;", 
                                   noquote(paste0(outcome_column_names, collapse = ",")))

# read from db
DF = read.jdbc(url = jdbcUrl, 
                tableName = df_query, 
                partitionColumn = "id", 
                user = username, 
                password = pw)

上述代码导致以下错误:

Error: Error in jdbc : argument is of length zero

我试图将read.jdbc的参数作为字符串插入,但它仍然返回相同的错误。我也用谷歌搜索,但找不到相同的问题。我在这里缺少什么?

0 个答案:

没有答案