How to view an image from blob column in Oracle with JasperReports?

Without seeing how you’re calling the blob to embed the image within your report code…

  1. Use blob.getBinaryStream().
  2. Convert the stream using javax.imageio.ImageIO.read( InputStream ).

For example:

javax.imageio.ImageIO.read( blob.getBinaryStream() )

This will return an instance of BufferedImage, which subclasses java.awt.Image, and should be a suitable object to embed in the report.

The blob variable shown in the example will have to use the appropriate variable from the report (that represents the data from the desired column).

See also:

Leave a Comment