473,418 Members | 2,008 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,418 software developers and data experts.

How to display multiple images from database using JSP

selvasoft
Hi
Please help me any one. I want solution for display multiple images from oracle database.Using JSP.
here is my code for display one image from database.
Please Any one give me some ideas.

Expand|Select|Wrap|Line Numbers
  1. <%@ page import ="java.sql.*,java.util.*,java.awt.*,java.io.*" %>
  2.  
  3.  
  4. <%
  5.       String DomainName ="jdbc:oracle:thin: ";
  6.       String UserName=" ";
  7.       String PassWord=" ";
  8.            byte[] image = new byte[300000];
  9.            try
  10.            {
  11.  
  12.                   int n=0;
  13.                   n =System.in.available();
  14.                   image = new byte[n];
  15.                  Image pic =null;
  16.                   Blob blob =null;
  17.  
  18.                   String QS =" Select simage  from image Where IMGID=1";
  19.  
  20.                    Class.forName("oracle.jdbc.OracleDriver");
  21.                    Connection cn=DriverManager.getConnection(DomainName,UserName,PassWord);  
  22.                    Statement  st=cn.createStatement();
  23.                    ResultSet  rs= st.executeQuery(QS);
  24.      OutputStream o=null;
  25.                    while(rs.next())
  26.                    {
  27.                      image  =rs.getBytes(1);                    
  28.  
  29.  
  30.     response.setContentType("image/gif");
  31.     o =response.getOutputStream();
  32.     o.write(image);
  33.     o.flush();
  34.  
  35.                    }
  36.  
  37.  
  38.     o.close();
  39.     out.close();
  40.  
  41.  
  42.              }
  43.            catch(Exception e)
  44.            {
  45.                System.out.println(e);
  46.            }
  47.  
  48. %>
  49.  
Apr 29 '10 #1
0 3229

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

Similar topics

3
by: RAllsopp | last post by:
I have a client who would like to have several pictures associated with one system. I have read about storing only the pathname to save OLE overhead and have set-up a form for my client to...
0
by: misscrf | last post by:
I am currently working on a database, in 3rd normal form, which is for candidates who apply for a job with the law firm that I workd for. My issue is with good form design. I have a main...
12
by: Wadim Grasza | last post by:
I want to store and display (on a form or a report) multiple pictures per record in an access database. The pictures are not stored within the database. They are stored as files and the database...
5
by: david | last post by:
Can I use WriteFile methods? It seems that it does not work. For example, the following code only dispay one figure. Response.WriteFile("images/image002.jpg") Response.Write("<br><p>")...
2
by: Adam | last post by:
I have extensively searched for a solution. Below is my code that is contained in an aspx. When my browser hits this aspx, I just get the standard broken image picture. I know the data is the...
5
by: Peter Lapic | last post by:
I have to create a image web service that when it receives an imageid parameter it will return a gif image from a file that has been stored on the server. The client will be an asp.net web page...
5
by: GH | last post by:
Is it possible to display images on the desktop itself, like the bacground but not as a background? And not as icons either. Anything you put in the \Desktop folder shows up as an icon on the...
7
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...
11
by: Jankie | last post by:
I need to dispaly a user's multiple images in one entry.Right now,say if a user uploads 3 images,three entries for the same id display to match 3 images. I only want 1 entry to display all of a...
3
by: Ian | last post by:
I have a form with a sub form, on the continues sub for I want to display some data along with a picture, on the On Current event I have the code: .Picture = Nz() is the name of the picture...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...
0
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...

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.