This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
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 Head First Android this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Problem to display clob data" Watch "Problem to display clob data" New topic
Author

Problem to display clob data

Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 833
Hello,

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: 1138
    
    1

Farakh,
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,
Avi.
Farakh khan
Ranch Hand

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


Best regards
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 20049
    
  30

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem to display clob data
 
It's not a secret anymore!