• Post Reply Bookmark Topic Watch Topic
  • New Topic

JDBC insert into CLOB  RSS feed

Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello. If anybody has a minute, I am trying to take a more JDBC approach to insert a CLOB into Oracle rather than relying on oracle.sql.CLOB.

In any case, this works via instantiating an oracle.sql.CLOB obect

oracle.sql.CLOB clob=oracle.sql.CLOB.createTemporary(conn , true , oracle.sql.CLOB.DURATION_SESSION );
clob.open( oracle.sql.CLOB.MODE_READWRITE );
statement.setClob(i+1, clob);

however, Oracle can't seem to see the CLOB as a CLOB if i take a jdbc approach...I receive ORA-01461: can bind a LONG value only for insert into a LONG column...

StringReader reader = new StringReader(current_string);
InputStream is_reader = new ByteArrayInputStream(current_string.getBytes());
statement.setCharacterStream(i+1, reader, current_column_value.length());

i am thinking I need to do something to instantiate the CLOB so Oracle understands that it is a CLOB, is that right? Thank you...
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!