Loading byte array from database and displaying it as image!!

 Hi all,

               I wish to display images on my report. These are stored in SQL server as varbinary fields. Can anyone here please tell me the procedure of how to display images (in byte[]).

I did exactly what is mentioned in

http://rgauss.com/category/interface/---getting no such method exception...

and  http://vmustafayev4en.blogspot.com/2011/08/read-alfresco-node-to-byte-array-in.html-- here I am getting java.lang.ArrayIndexOutOfBoundsException: -77.

 

Thanks,

Vivekanand Alampally.

 

 

vivek4348's picture
Joined: Sep 9 2011 - 6:16am
Last seen: 7 years 10 months ago

2 Answers:

Hi Vivekanand,

I haven't used SQL server only MySQL but I assume the image is converted to the same java Object.

logo is the SQL field. i.e select logo from company;

Hope it helps.
Munga

Code:
<imageExpression class="java.io.InputStream"><![CDATA[((java.sql.Blob)$F{logo}).getBinaryStream()]]></imageExpression></td></tr></tbody></table>
munga's picture
492
Joined: Jan 14 2008 - 4:12pm
Last seen: 10 months 2 weeks ago

 Thanks Munga for your solution..

I tried http://www.kavecan.com/index.php?id=82 and it worked...

Thank you,

Vivek..

 

vivek4348's picture
Joined: Sep 9 2011 - 6:16am
Last seen: 7 years 10 months ago

does this mean you want to convert byte array to image, here is tutorial and codes: http://www.rasteredge.com/how-to/csharp-imaging/covert-image-to-byte/

face_sad - 9 years 3 months ago
Feedback