• 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

saving Very Very long string to Oracle DB

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All

I have a problem saving a very, very long string to oracle database, using JDBC2.0. Here are the approaches I used and the resulting errors I got.

1) using a pstmt.setString() which bounces with string literal too long
2) using setClob() which throws an abrtract method error when I try to convert the string to clob using java.sql.Clob's setString(). (obvious because java.sql.Clob is an interface). If anyone could point me to a class that implements all these methods that would be helpful.
3) I tried using setAsciistream() got a class cast error.

coming to specs I am using JDK1.4 and oracle9.2

If anyone had an experince with this kinda thing, please help me.

Thanks
Praveena
 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
in order to use setClob you need to have a Clob object. it can be created as mentioned below

 
Praveena Surapaneni
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But the Clob in setClob method needs to be java.sql.Clob and not Oracle.sql.CLOB. Any other ideas on changing the string to clob
 
Karthikeyan Rajendraprasad
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
pstmt.setObject(colno, b, java.sql.Types.CLOB)

its not java.sql.Clob its java.sql.Types.CLOB

this should solve it...

[ August 17, 2005: Message edited by: Karthikeyan Rajendraprasad ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic