File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC insert into CLOB

 
Tom Griffith
Ranch Hand
Posts: 275
  • 0
  • 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 );
clob.setString(1,current_string);
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...
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic