Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem to display clob data

 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Avi Abrami I tried and now it displaying:


Best regards
 
Rob Spoor
Sheriff
Pie
Posts: 20527
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic