473,545 Members | 2,688 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

retriving the image from mysql display into jsp

kaleeswaran
132 New Member
ResultSet rs=st.executeQu ery("select i_sign from t_customer_phot o where n_customer_id=1 ");
while(rs.next() )
{
byte[] bytearray = new byte[4096];
int size=0;
InputStream sImage;
sImage = rs.getBinaryStr eam(1);
response.reset( );
response.setCon tentType("image/jpeg");
response.addHea der("Content-Disposition","f ilename=logo.jp g");
while((size=sIm age.read(bytear ray))!= -1 )
{
response.getOut putStream().wri te(bytearray,0, size);
}
response.flushB uffer();
sImage.close();
rs.close();
}

this is my code retriving the image....
pls help me if you find out the error....
Sep 28 '07 #1
3 2624
r035198x
13,262 MVP
ResultSet rs=st.executeQu ery("select i_sign from t_customer_phot o where n_customer_id=1 ");
while(rs.next() )
{
byte[] bytearray = new byte[4096];
int size=0;
InputStream sImage;
sImage = rs.getBinaryStr eam(1);
response.reset( );
response.setCon tentType("image/jpeg");
response.addHea der("Content-Disposition","f ilename=logo.jp g");
while((size=sIm age.read(bytear ray))!= -1 )
{
response.getOut putStream().wri te(bytearray,0, size);
}
response.flushB uffer();
sImage.close();
rs.close();
}

this is my code retriving the image....
pls help me if you find out the error....
1.) Please use code tags when posting code
2.) Please do not flood the forum with the same question. Double posting is generally considered rude around here.
3.) What happened when you tried the code? Where there any errors/exceptions?
Sep 28 '07 #2
kaleeswaran
132 New Member
No,there is any error occurred.but image page display likes empty page.
Sep 28 '07 #3
r035198x
13,262 MVP
No,there is any error occurred.but image page display likes empty page.
Isn't the coloumn a Blob?
What happens if you use

Expand|Select|Wrap|Line Numbers
  1. image = rs.getBlob(1);
  2. imgBytes = image.getBytes(1,(int)image.length());
Sep 28 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
3225
by: Eric Kincl | last post by:
Hello, its been a while since I posted/looked here... my normal email client doesn't handle newsgroups :( (ximian evolution) I was wondering how you stick a file into a database, and then retrive it again for the user with PHP/MySQL. I tried the following which apparently didnt work... Very quick overview of what I did... html
5
12010
by: Alper Adatoz | last post by:
Hi, i have a little problem. i hope u guys give me a clear solution (: db: mssql i just want to put jpeg file to the image field at the mssql db. and after that i want to call it back..
2
2262
by: david | last post by:
Hi, I have asp pages running from a MySQL database. I have placed a path in the required field (although not quite sure on the correct format). My asp page is just displaying the text path instead of the image. I'm using response.write. The Folder is called : images
2
2459
by: Manish Naik | last post by:
Hi, Using ASP.Net, I want to store and retrive documents (Word, excel, etc) from SQL Server 2000 database. I have tried image type data field, but could not succed. Can any one help me please. Regards, Manish Naik
2
3073
by: balakrishnan.dinesh | last post by:
Hi frnds, Im having a problem with retriving "\" backslash , In my javascript client side page , ill get the response from the server side , the response will contain some url like "\bank\index.htm" . So what i have to do is, ill get those url and display them in textfields , The problem is , while retriving the url , the backslashes are...
7
5389
by: eholz1 | last post by:
Hello Group, Perhaps you can help me. I have a mysql db, that holds images. Images are encoded using base64_decode/encode, etc. Image data seems fine. I have a view.php page that is supposed to show the image, and an image.php page that accesses the database, retrives the image data, and then (theoretically) prints the decoded data to...
1
2570
by: Kunal Nandi | last post by:
can any one give me the code for uploading and retriving image using Blob, with jsp at front end and oracle8i at the back end ??????? i have tried this using long raw datatype i was able to upload it, but while retriving first i have to create a temporary image file for that. and then i m able to retirve it on the web page, but i want it to be...
2
1652
by: soma.gunasekaran | last post by:
Hi All , I've stored the Image file..... But i want to retriving the Image files from MSACCSS 2003 (JPEG,bmp,Gif and etc....) So Pls help me........ help me............... Thanking you, Somasundaram G
4
8138
by: foss | last post by:
HI all, I am able to upload the image as blob to mysql. but while displaying the image i cant display it properly . The code used for uploading image to mysql inserts data into mysql table.The uploading code is: MYSQL_CONNECT("localhost","root",""); mysql_select_db("sample"); $data = addslashes(fread(fopen($form_data, "r"),...
0
7502
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7434
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7457
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5360
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3491
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3470
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1045
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
744
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.