【发布时间】:2017-11-03 01:30:32
【问题描述】:
我正在尝试绑定一个准备好的语句参数,它是一个数组 PostgreSQL。这是一个示例查询:
prepareStatement("UPDATE " + emailsFromDb.get(i) + " SET columne =testvalue '," + id + "' WHERE id IN (?)" );
我从 txt 文件值作为数组读取这是从 txt 读取的代码
Scanner inFile1 = new Scanner(new File("file.txt"));
while(inFile1.hasNext()) {
sb.append(inFile1.nextLine());
}
String[] testArray = sb.toString().split(", ");
并在sql中准备数组
Array bulkarr= connector.createArrayOf("INT", testArray);
pr.setArray(1, bulkarr);
pr.executeUpdate();
结果我有这个错误
2017-11-02 17:12:58 --ERROR-ApplicationErrorMessage :
org.postgresql.util.PSQLException: ERROR: operator does not exist: integer = integer[]
Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts.
Position: 106
我需要更新数组 postgres 中的位置
【问题讨论】:
标签: java postgresql