• 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 ...
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

How to Convert a java.sql.CLOB object to String  RSS feed

Posts: 27
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have a PL/SQL procedure �reorganize_report� which returns a CLOB object. This proc is being called through a java file named ReportDAO.java in the following way-

csmt = con.prepareCall("{call report_spk.reorganize_report(?,?,?,?) }");

I am retrieving the Clob�s like this � (the CLOB object is of java.sql.CLOB class)
Clob sourcelocationLst = csmt.getClob(7);
Clob newlocationLst = csmt.getClob(8);
Clob fileNameLst = csmt.getClob(9);

Now I need to convert this CLOB into a String object.
I tried using the toString() function present for CLOB�s but it gives me the following o/p - oracle.sql.CLOB@66c9b250

Can anybody help me out with this?
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you look at the java.sql.Clob, there's a method called getCharacterStream() that returns a Reader. You can use the Reader and convert it into String.

Hope that helps.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!