Jump to content

Image BLOB postgres


flexpadawan

Recommended Posts

Hey All,

Found a simple little tutorial on the subject of inserting an image from a database, in my case postgres.

http://ireport-tutorial.blogspot.com/2008/11/show-blob-image-in-ireport.html

But for whatever reason it will not work for me.  I've tried creating a simple report with one image on ver: 3.0.0 and the latest 3.5.0.

First thing I thought was maybe something was wrong with the image.  So I did a lo_export of the image and saved it to my desktop.  It worked so my data from teh db is correct.  The image was save as test.jpg so this should work with iReports.

Just as a recap this is what I've done.

1.  Fields:  Changed the propery to java.io.InputStream

2.  Inserted an image

3.  Changed the image to java.io.InputStream as well.

4.  Changed the Image expression to $F{image_table_file_blob}

I run the report and get a bunch of errors.

Example:

Error exporting print....Image read failed.

   at net.sf.jasperreports.engine.util.JRJdk14ImageReader.readImage(JRjdk14ImageReader.java:77)

etc....

 

Any help would be appreciated.

 

 

Link to comment
Share on other sites

  • 4 years later...
  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

  • 4 years later...
  • 2 months later...

I'm also having the same problem. In my scenario the table in postgres is as follows

create table category_images4  (
"id_category" int primary key,
"category_name" TEXT,
"category_image" oid
)

and the insert statement is : 

insert into category_images4(id_category,category_name,category_image) values(1,'tablette', lo_import('C:UserssadakarPicturesSaved Picturespics1.png'));

I could see that data is stored in table without any issue and the selection of the data : 

select * from category_images4;

id_category category_name category_image

1  tablette 19902
 

In jasper reports I have changed the category_image type to java.io.InputStream but this doesn't work for me. 

I(we) will be very grateful if someone could shed some light on this thread. 

Thank you in advance. 

 

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