macaxrc Posted April 18, 2015 Share Posted April 18, 2015 Hi, I have a problem when load a blob image stored in a MySql data base.I'm try to do this http://stackoverflow.com/questions/15833031/jaspersoft-studio-report-how-to-insert-images-from-database but not works.I have a fileld ${image_blob} type java.io.InputStream and in a table put and image and in the expresion select this field. When I execute the report show the second error:net.sf.jasperreportengine.JRException: Image Read failed at net.sf.jasperreportengine.utilJRJdk14ImageReader.readImage(JRJdk14ImageReader.java:73....Can I help me? Thanks Link to comment Share on other sites More sharing options...
macaxrc Posted April 20, 2015 Author Share Posted April 20, 2015 Can I help me please? I do not know what to do Link to comment Share on other sites More sharing options...
mlopez_1 Posted April 20, 2015 Share Posted April 20, 2015 This what i did:- Create an object of type Image- Put a SQL Select with the name of the fileds who have images- Read all fileds from Select an then change Class Type to java.io.InputStream for those who were imagesThis works for me since Jasper Server 5.5 against Oracle 11g r2 Regards, Mariano Link to comment Share on other sites More sharing options...
macaxrc Posted April 20, 2015 Author Share Posted April 20, 2015 Thanks, but I'm try this and don't work. I get an error message like the one I have set appears.It's possible that this error is for jdk verison? Link to comment Share on other sites More sharing options...
tchen Posted April 20, 2015 Share Posted April 20, 2015 How did you test the report with this BLOB image embedded? Do not use iReport 5.5/5.6, use JasperStudio or JasperReports Server to test the report instead. Link to comment Share on other sites More sharing options...
macaxrc Posted April 21, 2015 Author Share Posted April 21, 2015 Yes, to test de jasper I'm using Jasper Report Server 5.5, I test it using browers and conecting to the server. I have run all the resources , I have seen some case also get the same error .[/code]Any idea? Link to comment Share on other sites More sharing options...
tchen Posted April 21, 2015 Share Posted April 21, 2015 How did you define the image type of the BLOB column and how did you display it in the report table?The following should work in JRS 5.5:<field name="image" class="java.io.InputStream"/>[/code]<imageExpression><![CDATA[$F{image}]]></imageExpression>[/code] Link to comment Share on other sites More sharing options...
tchen Posted April 22, 2015 Share Posted April 22, 2015 Import this sample report into your JRS 5.5 repository and test the report in publicTTCsample_report_using_blob_image folder. The report output looks like the following: Link to comment Share on other sites More sharing options...
macaxrc Posted May 5, 2015 Author Share Posted May 5, 2015 Hi! Yes, this exemple run perfectly, but I don't find the stored image data. Is possible to see the data?I think that is possible that my image is stored in diferent codification that java.io not able to read.How you stored the image in MySql Data base?Thanks Link to comment Share on other sites More sharing options...
tchen Posted May 6, 2015 Share Posted May 6, 2015 I am not sure how you tested my sample report (by saying "this exemple run perfectly"). If you indeed have imported the sample into your JRS 5.5 repository, you should have seen image file is under the same report unit folder.This report image is stored in JRS repository database. That is the reason I provide you that sample zip file for you to IMPORT into JRS. In the zip file, it contains not only the report design, but also all report deployment resources including data source connection information and image file. After running the import, you should have everything stored in the reposiotry database ready for report execution. You can review report design using Studio JRS plugin to see where the image blob is comming fromselect f.id, f.data as image from jifileresource finner join jiresource r on r.id = f.id and f.file_type = 'img' and r.description = $P{image_description}[/code] and review report unit deployment in JRS web UI to see all the pieces - refer to JRS User Guide adn jasper Studio User Guide for detail (sorry, but I do not wish to recite User Guide information here). The report is deployed in publicTTCsample_report_using_blob_image folder. 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