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

Load blob image in a table component


macaxrc

Recommended Posts

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

  • Replies 9
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

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 images

This works for me since Jasper Server 5.5 against Oracle 11g r2

 

Regards,

 

Mariano

Link to comment
Share on other sites

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

  • 2 weeks later...

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

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 from

select 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

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...