我正在尝试将R data.frame写入Netezza表。它有大约55K行,我已经设置4GB作为Java的内存限制(选项(java.parameters =" -Xmx4096m"))
查询:
insert into MY_TABLE_NAME select * from external 'csv_file_containing_data_frame.csv' using (delim ',' remotesource 'jdbc');
当我从DbVisualizer这样的工具运行时,上面的SQL 工作没有任何问题但是当我尝试从RStudio运行它时出现以下错误。
R代码:
driver <- JDBC(driverClass="org.netezza.Driver", classPath = "drivers//nzjdbc.jar", "'")
connWrite <- dbConnect(driver, "jdbc:netezza://DB_SERVER:1234//DB_NAME", username, password)
str_insert_query <- paste(
"insert into MY_TABLE select * from external '", OutputFile , "' using (delim ',' remotesource 'jdbc');", sep = ""
dbSendQuery(connWrite, str_insert_query[1])
dbDisconnect(connWrite)
错误消息:
Error in .verify.JDBC.result(r, "Unable to retrieve JDBC result set for ", :
Unable to retrieve JDBC result set for insert into MY_TABLE select * from external 'C:/.../csv_file_containing_data_frame.csv' using (delim ',' remotesource 'jdbc'); (netezza.bad.query.result)
任何帮助将不胜感激。谢谢!
答案 0 :(得分:3)
需要使用 dbSendUpdate 。
dbSendUpdate(connWrite, str_insert_query[1])