ojive Posted January 20, 2011 Share Posted January 20, 2011 Greetings.I'm seriously frustrated with JasperReport and iReport tool. I've successfully created a report which im using in my Java application. I've spent days finding out how to display longblob images in my report, this is finally working.What i have issues with at the moment is reading text from a longblob field in my SQL database. It contains text (its a log). How do you do it in iReport? Field expression? Field config?I'm using iReport Designer 4.0.0.Code:<?xml version="1.0" encoding="UTF-8"?><jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="GUI2" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20"> <property name="ireport.zoom" value="1.0"/> <property name="ireport.x" value="0"/> <property name="ireport.y" value="312"/> <queryString> <![CDATA[]]> </queryString> <field name="foo" class="java.lang.String"/> <field name="foo" class="java.lang.String"/> <field name="foo" class="java.lang.String"/> <field name="foo" class="java.lang.String"/> <field name="foo" class="java.lang.String"/> <field name="foo" class="java.lang.String"/> <field name="foo" class="java.lang.String"/> <field name="FIELDWITHBLOB" class="java.io.InputStream"/> <field name="Imagefield" class="java.io.InputStream"/> <field name="Imagefield2" class="java.io.InputStream"/> <field name="foo" class="java.lang.String"/> <field name="foo" class="java.lang.String"/> <field name="foo" class="java.lang.String"/> <field name="foo" class="java.lang.String"/> <field name="foo" class="java.lang.String"/> <field name="foo" class="java.lang.String"/> <field name="foo" class="java.lang.String"/> <field name="foo" class="java.lang.String"/> <field name="foo" class="java.lang.String"/> <field name="foo" class="java.math.BigDecimal"/> <field name="foo" class="java.math.BigDecimal"/> <field name="foo" class="java.math.BigDecimal"/> <field name="foo" class="java.lang.String"/> <field name="foo" class="java.lang.Integer"/> <field name="foo" class="java.lang.String"/> <field name="foo" class="java.lang.String"/> <background> <band splitType="Stretch"/> </background> <detail> <band height="802" splitType="Stretch"> <textField> <reportElement x="0" y="100" width="182" height="20"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$F{foo}]]></textFieldExpression> </textField> <textField> <reportElement x="286" y="180" width="143" height="20"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$F{foo}]]></textFieldExpression> </textField> <textField> <reportElement x="0" y="180" width="286" height="20"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$F{foo}]]></textFieldExpression> </textField> <textField> <reportElement x="0" y="0" width="125" height="40" forecolor="#000000" backcolor="#000000"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$F{foo}]]></textFieldExpression> </textField> <textField> <reportElement x="386" y="259" width="169" height="20"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$F{foo}]]></textFieldExpression> </textField> <textField> <reportElement x="-1" y="259" width="200" height="20"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$F{foo}]]></textFieldExpression> </textField> <textField> <reportElement x="429" y="299" width="126" height="20"/> <textElement/> <textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{foo}]]></textFieldExpression> </textField> <textField> <reportElement x="182" y="100" width="193" height="20"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$F{foo}]]></textFieldExpression> </textField> <textField> <reportElement x="-1" y="60" width="555" height="20"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$F{foo}]]></textFieldExpression> </textField> <image isUsingCache="true" onErrorType="Blank"> <reportElement x="309" y="645" width="246" height="139"/> <imageExpression class="java.io.InputStream"><![CDATA[$F{foo}]]></imageExpression> </image> <textField> <reportElement x="200" y="259" width="186" height="20"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$F{foo}]]></textFieldExpression> </textField> <textField> <reportElement x="0" y="339" width="555" height="20"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$F{foo}]]></textFieldExpression> </textField> <textField> <reportElement x="0" y="219" width="429" height="20"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$F{foo}]]></textFieldExpression> </textField> <image isUsingCache="true" onErrorType="Blank"> <reportElement x="0" y="645" width="252" height="139"/> <imageExpression class="java.io.InputStream"><![CDATA[$F{foo}]]></imageExpression> </image> <textField> <reportElement x="342" y="20" width="213" height="20"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$F{foo}]]></textFieldExpression> </textField> <textField> <reportElement x="0" y="379" width="555" height="126"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$F{foo}]]></textFieldExpression> </textField> <textField> <reportElement x="429" y="180" width="126" height="20"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$F{foo}]]></textFieldExpression> </textField> <textField> <reportElement x="286" y="299" width="143" height="20"/> <textElement/> <textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{foo}]]></textFieldExpression> </textField> <textField> <reportElement x="286" y="140" width="269" height="20"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$F{foo}]]></textFieldExpression> </textField> <textField> <reportElement x="125" y="20" width="217" height="20"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$F{foo}]]></textFieldExpression> </textField> <textField> <reportElement x="375" y="100" width="180" height="20"/> <textElement/> <textFieldExpression class="java.lang.Integer"><![CDATA[$F{foo}]]></textFieldExpression> </textField> <textField> <reportElement x="125" y="299" width="161" height="20"/> <textElement/> <textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{foo}]]></textFieldExpression> </textField> <textField> <reportElement x="0" y="140" width="286" height="20"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$F{foo}]]></textFieldExpression> </textField> <textField> <reportElement x="429" y="220" width="126" height="20"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$F{foo}]]></textFieldExpression> </textField> <textField> <reportElement x="0" y="782" width="100" height="20"/> <textElement/> <textFieldExpression class="java.lang.Integer"><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression> </textField> <textField evaluationTime="Report"> <reportElement x="454" y="782" width="100" height="20"/> <textElement/> <textFieldExpression class="java.lang.Integer"><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression> </textField> <staticText> <reportElement x="342" y="0" width="29" height="20"/> <textElement/> <text><![CDATA[foo:]]></text> </staticText> <staticText> <reportElement x="125" y="0" width="33" height="20"/> <textElement/> <text><![CDATA[foo:]]></text> </staticText> <staticText> <reportElement x="0" y="40" width="45" height="20"/> <textElement/> <text><![CDATA[foo:]]></text> </staticText> <staticText> <reportElement x="0" y="80" width="30" height="20"/> <textElement/> <text><![CDATA[foo:]]></text> </staticText> <staticText> <reportElement x="182" y="80" width="44" height="20"/> <textElement/> <text><![CDATA[foo:]]></text> </staticText> <staticText> <reportElement x="375" y="80" width="22" height="20"/> <textElement/> <text><![CDATA[foo:]]></text> </staticText> <staticText> <reportElement x="0" y="120" width="30" height="20"/> <textElement/> <text><![CDATA[foo:]]></text> </staticText> <staticText> <reportElement x="286" y="120" width="34" height="20"/> <textElement/> <text><![CDATA[foo:]]></text> </staticText> <staticText> <reportElement x="-1" y="160" width="39" height="20"/> <textElement/> <text><![CDATA[foo:]]></text> </staticText> <staticText> <reportElement x="286" y="160" width="38" height="20"/> <textElement/> <text><![CDATA[foo]]></text> </staticText> <staticText> <reportElement x="429" y="160" width="45" height="20"/> <textElement/> <text><![CDATA[foo]]></text> </staticText> <staticText> <reportElement x="0" y="200" width="100" height="20"/> <textElement/> <text><![CDATA[foo:]]></text> </staticText> <staticText> <reportElement x="429" y="199" width="100" height="20"/> <textElement/> <text><![CDATA[foo:]]></text> </staticText> <staticText> <reportElement x="0" y="239" width="100" height="20"/> <textElement/> <text><![CDATA[foo:]]></text> </staticText> <staticText> <reportElement x="200" y="239" width="100" height="20"/> <textElement/> <text><![CDATA[foo:]]></text> </staticText> <staticText> <reportElement x="386" y="240" width="100" height="20"/> <textElement/> <text><![CDATA[foo:]]></text> </staticText> <staticText> <reportElement x="126" y="279" width="100" height="20"/> <textElement/> <text><![CDATA[foo:]]></text> </staticText> <staticText> <reportElement x="286" y="279" width="100" height="20"/> <textElement/> <text><![CDATA[foo:]]></text> </staticText> <staticText> <reportElement x="429" y="279" width="100" height="20"/> <textElement/> <text><![CDATA[foo:]]></text> </staticText> <staticText> <reportElement x="-1" y="279" width="126" height="40"/> <textElement/> <text><![CDATA[foo:]]></text> </staticText> <staticText> <reportElement x="0" y="319" width="100" height="20"/> <textElement/> <text><![CDATA[foo:]]></text> </staticText> <staticText> <reportElement x="-1" y="359" width="100" height="20"/> <textElement/> <text><![CDATA[foo:]]></text> </staticText> <staticText> <reportElement x="0" y="505" width="100" height="20"/> <textElement/> <text><![CDATA[foo:]]></text> </staticText> <textField> <reportElement x="0" y="545" width="554" height="81"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[""+$F{THISISMYBLOBFIELDTOREAD}]]></textFieldExpression> </textField> </band> </detail></jasperReport> Link to comment Share on other sites More sharing options...
ojive Posted January 20, 2011 Author Share Posted January 20, 2011 I can't even create byte arrays in the Field Expression to be able to convert a byte[] to a string :/I think it's so illogical that its "sooo easy" to convert a longblob to an Image, but converting a longblob to a String is completely unknown :| Link to comment Share on other sites More sharing options...
ojive Posted January 25, 2011 Author Share Posted January 25, 2011 bumping this one, as it's driving me utterly frustrated and slightly mental at this point. Link to comment Share on other sites More sharing options...
softboxkid Posted July 18, 2011 Share Posted July 18, 2011 i'm having the same problem too! Have anyone got the solution? Please.. /tools/fckeditor/editor/images/smiley/msn/sad_smile.gif 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