2004 IR Help Posted September 1, 2006 Share Posted September 1, 2006 By: Tony - massa3 how to read in CLOB 2004-06-08 07:03 Using iReport 0.3.1 and a jdbc connection (oracle.jdbc.driver.OracleDriver) how can I read in an oracle.sql.clob into an iReport field? What type should it be qualified as in iReport? By: Tony - massa3 RE: how to read in CLOB 2004-06-08 13:57 Can this even be done? By: Giulio Toffoli - gt78 RE: how to read in CLOB 2004-06-08 15:08 I think that you can write a simple class to handle CLOB, a class with a static method like this static String readCLOB(Object obj) { String txt = ""; if (obj instanceof com.oracle.jdbc.x.y.z.CLOB) { txt = .... code to extract text from clob clob... } return txt; } then you can use expressions like: MyClass.readCLOB( $F{CLOBFIELD} ) Please not that I don't have tested this proof of concept. Giulio By: Tony - massa3 RE: how to read in CLOB 2004-06-08 16:12 Thanks for the advice, I'll give it a try. :) By: Tony - massa3 RE: how to read in CLOB 2004-06-14 14:49 Having trouble accessing an external class like MyClass (see other posts) in the report.java file created by iReports. If I call my report "MyReport.xml" then iReports generates the MyReport.java (actually jasper generates this). Anyway the MyClass object is referenced in the MyReport.java file but there is no imports for MyClass.java. I suppose its a class path issue. Can anyone offer guidance on how to resolve this issue? By: Tony - massa3 RE: how to read in CLOB 2004-06-22 15:06 Well I finally got this to work thanks to the help of some knowledgeable developers. It looks like your initial guess was correct. Here is how I call the package in the text field of iReport. <br/><b> com.services.Util.convertClobObjToString($F{PM_SOP_DESC})</b> <br/> My class then converts the InputStream into a Clob which I pass to another class that parses the clop and outputs a String. <br/><b> public static String convertClobObjToString(Object obj) throws SQLException { String txt = ""; if (obj instanceof java.sql.Clob) { Clob clob = (Clob)obj; txt = convertClobToString(clob); } return txt; } </b> <br/> The convertClobObjToString method uses the Reader in = clob.getCharacterStream(); <br/> Then parsing of the stream begins, appending each byte as a string to a string buffer. <br/> Hope this helps someone. By: Tony - massa3 RE: how to read in CLOB 2004-06-23 06:59 Forgot to mention I had to edit the xml file : <field name="CLOB_DESC" class="java.lang.Object"/> </br> and the textField is of type java.lang.String By: Giulio Toffoli - gt78 RE: how to read in CLOB 2004-06-24 00:59 You can add your field from the fields window, instead to edit xml. Anyway all seems good. Giulio Link to comment Share on other sites More sharing options...
wentwog Posted September 8, 2011 Share Posted September 8, 2011 Thank'ya very much !! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now