Jump to content
We've recently updated our Privacy Statement, available here ×

How to Import a Image from Database


atharindhi

Recommended Posts

I need ti import a blob image from Oracle to ireport..
hw can i do this...

I've done following changes in XML code..
But im getting errors..

<imageExpression class="java.awt.Image"><![CDATA[JRImageLoader.loadImage((byte[])$F{IMAGE})]]></imageExpression>

<field name="IMAGE" class="java.lang.Object"/>

<import value="net.sf.jasperreports.engine.util.JRImageLoader" />

Im getting this error


 

Code:
Error filling print... Error evaluating expression :      Source text : $F{IMAGE} net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression :      Source text : $F{IMAGE}      at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:195)      at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:589)      at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:557)      at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:929) 

Post Edited by atharindhi at 09/23/2010 13:29
Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Hi,

 

If you want to load the image yourself, then you can declare the field as beeing of type java.io.InputStream or java.sql.Blob.

But I suggest you simply declare the report field as being of type java.awt.Image and let JR load it for you.

 

You then make sure that the image element expression is also of type java.awt.Image.

 

I hope this helps.
Teodor

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...