Links

   Quran Explorer - Interactive Audio Recitations & Translations

Thursday, February 28, 2013

Photos from DB to JasperReport

In my previous post i mentioned byte array datatype.
Its a simple(or is it simplistic) way of saving binary data into a db table. One example immediately comes to mind... yes photos!! "i want to save photos and render them in a printable report"

POSTGRES SQL

TABLE CREATE TABLE student(
student_id serial primary key,
reg_no varchar(7) not null,
photo bytea,
..
..
..
remarks text
);

The only field of interest is the photo field which is a byte array type

Most of the time i use iReport to design JasperReports and in this example I will use iReport 4.0

[[]]


Never mind.... the most important part is the ImageExpression class in the dynamic image.

Make sure its class is java.io.InputStream.

This may not be available in the iReport properties section so what u will do in such a case is click on the XML tab and type java.io.InputStream save then have fun coding

No comments:

Post a Comment

Feel free to leave a comment