• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

How to insert and retrieve clob

Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
In my application ,one datatype has been changed to clob(5000) from varchar2(4000).I wrote the following code to insert and select..(for Clob)

String value=requestComment.getComment();
StringReader r = new StringReader((String)value );
preparedStatement.setCharacterStream( 4, r, ((String)value).length());

// for retrieve(select)
myClob = resultSet.getClob(COMMENT_X);
Reader clobData = myClob.getCharacterStream();
CharArrayWriter writer=new CharArrayWriter();
int i=-1;
while((i = clobData.read()) !=-1) {

I gave morethan 4000 character as input ,I am getting the following the error..

Mapping the following SQLException, with ErrorCode 17,410 and SQLState <null>, to a StaleConnectionException: java.sql.SQLException: No more data to read from socket

Please let me know if someone can help me..

Thanks in advance...

Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in order to use setClob you need to have a Clob object. it can be created as mentioned below

set it as
He was expelled for perverse baking experiments. This tiny ad is a model student:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic