I have a merge query, where one of the column is of type CLOB
PreparedStatement pstmt = conn.prepareStatement("MERGE..");
for(List) {
//Update part
...
ByteArrayInputStream inputStream2 = new ByteArrayInputStream(model.getDescription().getBytes());
InputStreamReader inputStreamReader2 = new InputStreamReader(inputStream2);
pstmt.setClob(i++, inputStreamReader2);
//Insert
..
ByteArrayInputStream inputStream = new ByteArrayInputStream(model.getDescription().getBytes());
InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
pstmt.setClob(i++, inputStreamReader);
pstmt.addbatch()
}
pstmt.executeBatch();
it gives me java.sql.BatchUpdateException: ORA-03106: fatal two-task communication protocol
error at executeBatch line, but when I just set pstmt.setString(i++, "") it works, meaning this exception because of these 2 CLOB setting. What mistake am I making?
I solved using clob = conn.createClob(); Not sure why i did not use this before.