ericlomm Posted May 3, 2011 Share Posted May 3, 2011 Hello,I am currently in the process of creating some reports for a new client that will be showing captured images from paper documents as the details that are shown in the report.I am currently storing the images that I want to have as the details as BLOB data in a MySQL database. When I try and add the images to a report in Ireport however I am not able to get the results that I am looking for.The first thing that I have tried is to just include the field from the query. When I do this the result that I see is the first 10 hexidecimal characters of the image file.Next I tried adding an image object to the report and setting its source to be the column in the Database that stores the image. I have tried this with various settings for the expression class but whatever I am using I get an error similar to the one below, (the details change slightly based on the expression class I use)Is it possible to included an image that is stored in a database as a part of a report in jasperreports? Eric Lommatsch Code:Error filling print... Error evaluating expression :     Source text : $F{pcxImage} Setting up the file resolver... net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression :     Source text : $F{pcxImage}     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)     at net.sf.jasperreports.engine.fill.JRFillImage.evaluateImage(JRFillImage.java:1023)     at net.sf.jasperreports.engine.fill.JRFillImage.evaluate(JRFillImage.java:1004)     at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:258)     at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:499)     at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2036)     at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:760)     at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:270)     at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:128)     at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:946)     at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:845)     at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:58)     at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:417)     at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:247)     at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:878)     at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)     at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997) Caused by: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object '[b@1a12d23' with class '[b' to class 'java.awt.Image'     at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:327)     at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.castToType(ScriptBytecodeAdapter.java:602)     at CourseComments_1304459981811_919575.evaluate(calculator_CourseComments_1304459981811_919575:185)     at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:182)     ... 19 more Print not filled. Try to use an EmptyDataSource... Link to comment Share on other sites More sharing options...
jpauze Posted May 3, 2011 Share Posted May 3, 2011 It is possible but don't think you can just include a BLOB column and display it, haven't done it personally but recall from the iReport documentation there is an example of how to process blobs to get images from the database. Not sure what is involved but iReport has no concept of the contents of a database BLOB, it's just data and won't treat it as an image unless you add the functionality to process and great the image on the fly. Which is what the documentation is showing anyway.Jeff 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