• Post Reply Bookmark Topic Watch Topic
  • New Topic

java.sql.SQLException: Invalid argument(s) in call @ When working with CLOB  RSS feed

Sravani cg
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I got below error when working CLOB. Initially i am inserted CLOB column with empty_clob() and then converting String Data in to CLOB and then update same in CLOB Column.

Previously with the same code its working fine. Not its not working as expected and throws below exception.

I am received above error on line clobWriter = clob.setCharacterStream(0L).


java.sql.SQLException: Invalid argument(s) in call
at oracle.jdbc.driver.T4CConnection.newWriter(T4CConnection.java:3497)
at oracle.sql.CLOB.setCharacterStream(CLOB.java:1168)


pstmt = connection.prepareStatement("SELECT DATA_COLUMN FROM X_TABLE WHERE ID=? FOR UPDATE");
pstmt.setInt(1, sqTranId);
rs = pstmt.executeQuery();
CLOB clob = (CLOB) rs.getClob(1);

private void populateCLOB(oracle.sql.CLOB clob, String data) throws IOException, SQLException {
StringReader reader = null;
Writer clobWriter = null;
try {
reader = new StringReader(data);

clobWriter = clob.setCharacterStream(0L);

// Get optimal buffer size to read/write data
char[] buffer = new char[clob.getBufferSize()];
int read = 0;
int bufflen = buffer.length;

// Read from String and write to CLOB
while ((read = reader.read(buffer, 0, bufflen)) > 0) {
clobWriter.write(buffer, 0, read);
} catch (Exception e) {

Please help me...!
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!