robixit
-
Posts
2 -
Joined
-
Last visited
Content Type
Profiles
Forum
Events
Featured Visualizations
Knowledge Base
Documentation (PDF Downloads)
Blog
Documentation (Test Area)
Documentation
Dr. Jaspersoft Webinar Series
Downloads
Posts posted by robixit
-
-
Hi, i apologize for my english
I am trying to show an oracle clob column in a 3.5.1 ireport field.
Retrieving field from ireport query, define this element as "oracle.sql.CLOB" but i don't know how to cast the item in the class expression of the field.
In version 3.0 i had a class expression as "java.lang.string" to cast the clob column, and i didn't have problems.
Thanks in advance.
Robi
-------------
ciao Giulio, scusa se scrivo in italiano ma il mio inglese è pessimo (come hai potuto notare).
Inizio con il farti i miei complimenti per questo magnifico strumento.
Premetto che NON sono uno sviluppatore java, uso ireport attraverso delle jsp sviluppate da me, per creare reports da pagine web create con il tool APEX della oracle (application express). Brevemente.. ho l'esigenza di stampare delle grosse porzioni di testo (clob) formattati con un markup di tipo html. Ho fatto qualche prova e, nella versione 3.0 classica mi sembra di aver capito che alcuni tipi di tag potevo usarli e altri no (alcuni ho visto che addirittura mandavano in dump il report, tipo le liste). Ho pensato quindi di passare all'ultima versione su ide netbean, e ora non capisco come definire queste colonne clob, perchè la query me le vede come oracle.sql.CLOB ma poi la classe espressione del field (java.lang.string) non riesce ad eseguire il cast. Ho provato ad anteporre nell'espressione del campo i doppi apici ( ""+$F{CLOB_COL} ) così il report gira ma nel campo vedo un'espressione del tipo "oracle.sql.CLOB@1d916ae".. Ti sono estremamente grato per qualsiasi aiuto potrai darmi.
Robi
ireport 3.5.1 + oracle clob field ( per Giulio )
in Products
Posted
Hi Giulio,
thank you so much for your help, i attach the source that i've in mind (i hope it's right)
hope it can be of help for others
public class MyClobClass {
public String clobToString(Clob clob) throws JRException {
String strlob = "";
try {
int bufSize = 8192;
char[] buf = new char[bufSize];
Reader reader = new BufferedReader(clob.getCharacterStream(), bufSize);
StringBuffer strbuf = new StringBuffer((int) clob.length());
for (int read = reader.read(buf); read > 0; read = reader.read(buf)) { strbuf.append(buf, 0, read); }
strlob = strbuf.toString();
}
catch (SQLException e) { e.printStackTrace(); }
catch (IOException e) { e.printStackTrace(); }
return strlob;
}
}
in the field definition: new MyClobClass().clobToString($F{CLOB_COL})