File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Problem to display clob data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Groovy Fundamentals video training course this week in the Groovy forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Problem to display clob data" Watch "Problem to display clob data" New topic

Problem to display clob data

Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 806

Oracle version is: 11.2, jdk7 and tomcat apache-tomcat-6.0.18
I am facing problem to retriew record from database. my code is as follow:

The record exists for desc2 but the above code output is "null" for desc2 whereas I checked on SQL prompt and its working fine.

I also called only desc2 column and its displaying ok.

My table structure is:

I stuck here. Please help me

Best regards
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1137

You state that the data type for column DESC2 in table NEWSARTICLES is CLOB.
In that case I believe you must change the following line of your java code:

to this:

Good Luck,
Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 806
Thanks Avi Abrami I tried and now it displaying:

Best regards
Rob Spoor

Joined: Oct 27, 2005
Posts: 19990

If you'd check the methods in java.sql.Clob you'd see one that returns a String. It takes two parameters, the start and end of the substring. If you provide 0 and clob.length() that will get you the entire text.

How To Ask Questions How To Answer Questions
I agree. Here's the link:
subject: Problem to display clob data