I'm attempting to write a clob to oracle using a TypeHandler as below:
public void setParameter(ParameterSetter setter, Object parameter) throws SQLException {
Reader bodyReader = null;
try {
bodyReader = new StringReader(parameter.toString());
setter.setCharacterStream(bodyReader,parameter.toString().length());
} catch (Exception e) {
e.printStackTrace();
throw new SQLException("Failed to set text field.");
}
}
This appears to work fine for small texts but once I get a large text (more then 4000 chars) then it fails. Actually nothing gets set and I get a null in the clob field in the database. Has anyone managed to solve this problem of writing clobs to an oracle database.
Cheers,
Steve.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I'm attempting to write a clob to oracle using a TypeHandler as below:
public void setParameter(ParameterSetter setter, Object parameter) throws SQLException {
Reader bodyReader = null;
try {
bodyReader = new StringReader(parameter.toString());
setter.setCharacterStream(bodyReader,parameter.toString().length());
} catch (Exception e) {
e.printStackTrace();
throw new SQLException("Failed to set text field.");
}
}
This appears to work fine for small texts but once I get a large text (more then 4000 chars) then it fails. Actually nothing gets set and I get a null in the clob field in the database. Has anyone managed to solve this problem of writing clobs to an oracle database.
Cheers,
Steve.