R代码增加Teradata JDBC驱动程序的最大字节长度

时间:2017-08-22 07:41:31

标签: r jdbc teradata rjava rjdbc

我试图通过RJDBC使用批量插入尝试将一些相当大的几何对象导出到R中的teradata中。问题是一些对象超过64000个字符:

  

.jcall错误(ps," V"," addBatch"):
  值java.sql.SQLException:   [Teradata JDBC Driver] [TeraJDBC 16.00.00.28] [错误1186] [SQLState   HY000]参数2长度为89190字节,大于   最多可以设置64000个字节。

看起来可以增加CLOB列的这个限制,但我还没有能够找到R代码来做到这一点:

Database is throwing exception while trying to store a file of size 2MB as a BLOB data

然后是我的插入代码:

myinsert <- function(...){
  kwargs <- list(...)
  for(i in seq_along(kwargs)) {
    .jcall(ps,"V","setString",as.integer(i), as.character(kwargs[i]))
  }
  .jcall(ps,"V","addBatch")
}
dbSendUpdate(conn, paste0("create table ", table_empty, "(SEA_ID INTEGER, poly SYSUDTLIB.ST_Geometry);"))
.jcall(conn@jc,"V","setAutoCommit",FALSE)
ps = .jcall(conn@jc,"Ljava/sql/PreparedStatement;","prepareStatement", paste0("insert into ", table_empty, " values(?, ?)"))

for(n in 1:nrow(polys_td)){ 
  myinsert(polys_td$SEA_ID[[n]], polys_td$poly[[n]])
}
.jcall(ps,"[I","executeBatch")

0 个答案:

没有答案