473,395 Members | 1,680 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

why I can't display a jpg Blob field in web?

hello,

I am retrieving the blob field with de following code:

----------
rs = st.executeQuery(sql);
if (rs.next()){
foto = rs.getBlob(1);
length = (int)foto.length();
InputStream in = foto.getBinaryStream();
buffer=foto.getBytes(0, length);
int bufferSize = 1024;
buffer = new byte[bufferSize];
while ((length = in.read(buffer)) != -1) {
miFicheroSt.write(buffer, 0, length);
}
}
----------

when I do:
<img src="../../tmp/<%out.println(nomFitxer);%>">

from a jsp file, it doesn't display a jsp.
It say that is not the correct format

Can you help me?

Nov 12 '05 #1
2 2025
You didn't post the query or the table definitions, let alone how you stored
the BLOB (AIV extender?). And whilst your post says jsp the subject say jpg.
And what your browser can render in an <img> is also unspecified. Finally,
web rendering isn't really a DB2 issue. Start at the beginning and post
sufficient details.

"asterix" <jo***********@urv.net> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...
hello,

I am retrieving the blob field with de following code:

----------
rs = st.executeQuery(sql);
if (rs.next()){
foto = rs.getBlob(1);
length = (int)foto.length();
InputStream in = foto.getBinaryStream();
buffer=foto.getBytes(0, length);
int bufferSize = 1024;
buffer = new byte[bufferSize];
while ((length = in.read(buffer)) != -1) {
miFicheroSt.write(buffer, 0, length);
}
}
----------

when I do:
<img src="../../tmp/<%out.println(nomFitxer);%>">

from a jsp file, it doesn't display a jsp.
It say that is not the correct format

Can you help me?

Nov 12 '05 #2
Although nothing to do with DB2 and so off topic here, did you not
overwrite your "buffer" containing the image data bytes with an empty
1024 byte array when you did
buffer=foto.getBytes(0, length);
int bufferSize = 1024;
buffer = new byte[bufferSize];


Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: sid_mulpuru | last post by:
I am trying to read data from a DB2 Blob Data type Field (using wsad 5.1.0) using getBlob() which when executed gives an SQL Exception 2005-01-07 15:48:40,506 ERROR - Error in...
11
by: Chris Fink | last post by:
I have setup an Oracle table which contains a blob field. How do I insert data into this field using C# and ADO.net?
2
by: RedSouljaz | last post by:
Hi, How to display image that was saved in database ms sql server 2000 into picture box. The field type that I use in database is Images I can save to database but cannot show from database. ...
2
by: pmz | last post by:
Dear Group, I'm connecting in C# with remote (BSD) MySQL server with ODBC Driver, and I'm trying to find the best sollution in such problem: As I've read on MySQL manual, they have suggested...
0
by: Big George | last post by:
I'm developing with ASP.NET, VS.NET 2003. Using Crystal Report for VS.NET DataBase: Oracle 10g I store a BLOB field in a table. This field store images, like jpg files. The Stored Procedure...
0
by: Big George | last post by:
Hello, I'm trying to save a jpg file of 300KB as a BLOB field in an Oracle 10g Database. If I try to call a Stored Procedure, it fails. If I use CommandText with SQL sentence, it success. I...
2
by: Vinciz | last post by:
hi guys... im new in java and i would love to learn some of these... basically i got a sample code to retrieve the blob from the mysql. however, i dont really know what to do with these...
1
by: rokenbok | last post by:
hi, I have a password field that I need to store in a db2 database. I created a blob field in my table, and I am trying to update it with the following java dal.getPrepared().setBytes(15,...
8
by: leegold58 | last post by:
Hi, I have MS Access 2002. I want to make create a table with a blob field but I don't see that option when creating a table. I want to store text in the blob field. How do I do this? ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.