• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JDBC insert into CLOB

 
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic