Reputation: 175
I am getting ORA-01704: string literal too long
error when there is more than 4000 chars for the field RAWDATA. The data type is CLOB. I am using java 1.4 and oracle 10g.
stmt = conn.prepareStatement("INSERT INTO RAWDATA_EQUIFAX (REQ_ID, BUREAU_CODE, RAWDATA, RESP_TIME) VALUES (?, ?, ?, ?)");
stmt.setInt(1, RequestID);
stmt.setString(2, bureau_code);
stmt.setString(3, rawData);
stmt.setTimestamp(4, new Timestamp(date.getTime()));
stmt.executeUpdate();
conn.commit();
Upvotes: 1
Views: 3426
Reputation: 404
I think you should use this to set Clob parameter to the PreparedStatement:
Clob clob = conn.createClob();
clob.setString(1, rawData);
stmt.setClob(3, clob);
clob.free();
Upvotes: 0
Reputation: 46239
Don't use PreparedStatement#setString()
to set a Clob
.
There is a PreparedStatement#setClob()
method that you can use instead.
Upvotes: 3