It's not a secret anymore!
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 Java Interview Guide this week in the Jobs Discussion 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: 833

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: 1141

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: 833
Thanks Avi Abrami I tried and now it displaying:

Best regards
Rob Spoor

Joined: Oct 27, 2005
Posts: 20279

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
It's not a secret anymore!