报错信息:
org.postgresql.util.PSQLException: PreparedStatement can have at most 65,535 parameters. Please consider using arrays, or splitting the query in several ones, or using COPY. Given query has 661,068 parameters
; SQL []; PreparedStatement can have at most 65,535 parameters. Please consider using arrays, or splitting the query in several ones, or using COPY. Given query has 661,068 parameters; nested exception is org.postgresql.util.PSQLException: PreparedStatement can have at most 65,535 parameters. Please consider using arrays, or splitting the query in several ones, or using COPY. Given query has 661,068 parameters
翻译:
这个错误是因为PreparedStatement最多只能有65,535个参数。你可以尝试使用数组、将查询拆分成几个部分或者使用COPY方法来解决这个问题。
导致原因:
数据入湖,一次性批量新增一万多条数据,加不进去,报错,没想到PreparedStatement还有限制。文章来源:https://www.toymoban.com/news/detail-744295.html
解决方案:
改成用分页的方式,查询写表,如果分页数大于1则继续查询写表,但是要确保查询的数据是未入湖的数据,知道查询到的分页数为1时,即全部入湖成功。文章来源地址https://www.toymoban.com/news/detail-744295.html
到了这里,关于批量新增报错PSQLException: PreparedStatement can have at most 65,535 parameters.的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!