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

how to display images getting from database


Recommended Posts

By: venkat - venkatkodali

how to display images getting from database

2005-12-05 11:25

Pl Help Me

How to get the images from database and display them on report

 

 

By: Teodor Danciu - teodord

RE: how to display images getting from databa

2005-12-06 06:18

 

Hi,

 

If your images are stored inside a BLOB column in

the database, then you can declare your report

field of type java.awt.Image and then use the field inside an image expression.

 

I hope this helps.

Teodor

 

 

 

By: venkat - venkatkodali

RE: how to display images getting from database

2005-12-06 07:52

Hi Teodor,

 

Thanks for the reply.

 

But still i am facing some problem

 

net.sf.jasperreports.engine.JRException: Error executing SQL statement for report : Official_List

 

Caused by: java.sql.SQLException: ORA-00932: inconsistent datatypes: expected - got BLOB

 

Regards

 

 

By: Lucian Chirita - lucianc

RE: how to display images getting from databa

2005-12-06 08:30

Hi

 

Which JR version are you using? java.awt.Image fields are only supported since 1.0.0.

 

If you have an older version, try setting the field type to java.io.InputStream and using the field value as imageExpression.

 

HTH,

Lucian

 

 

By: C-Box - c-box

RE: how to display images getting from databa

2005-12-06 08:46

If your images are byte[] or compressed or you use different databases just make an HelperClass that loads your Images from DataBase and returns as java.awt.Image

 

in your image-expression you can call something like:

 

MyDBImageLoader.loadImage("ImageNameOrIDorWhatEver")

 

hth

C-Box

 

 

By: venkat - venkatkodali

RE: how to display images getting from database

2005-12-06 10:10

Hi,

 

I am using JR version 1.0.1

and i am using as

 

<field name="image_data" class="java.awt.Image"/>

<variable name="Signature" class="java.awt.Image" resetType="None" calculation="System">

</variable>

 

<imageExpression class="java.awt.Image"><![CDATA[$V{Signature}]]></imageExpression>

 

byte[] digSignature = (byte[]) this.getFieldValue("image_data");

in the scriptlet i am checking wether the signature is avialble or not if available i will display the signature otherwise nosignature image from local will be displayed

 

 

 

 

 

 

 

By: Lucian Chirita - lucianc

RE: how to display images getting from databa

2005-12-07 01:59

If the image_data field is java.awt.Image, why do you expect byte[] from getFieldValue()?

 

Regarding the Oracle error, what is your query?

 

 

By: venkat - venkatkodali

RE: how to display images getting from database

2005-12-07 07:18

query looks like this

 

select im.id_emp, im.image_data, em.ad_num, em.ad_str1, em.ad_str2 from image im, emp em where em.id_emp=im.id_emp

 

here image_data is BLOB

 

 

 

 

 

By: Lucian Chirita - lucianc

RE: how to display images getting from databa

2005-12-08 00:10

Try running your query in sql*plus. If it fails, it's a problem with your query and not with JasperReports.

 

Regards,

Lucian

 

 

By: venkat - venkatkodali

RE: how to display images getting from database

2005-12-13 06:53

Hi Lucian,

 

Thanks, that was the query problem

 

I have one more issue that was the performance issue, I have to show approxmatly 6000 records on the report it was taking so much time can u pl suggest me

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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