Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Servlet How to display images in jsp ffrom sqlserver2000
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


vel
How to display images in jsp ffrom sqlserver2000
1 Answer(s)      6 years and 5 months ago
Posted in : JSP-Servlet



Advertisement
View Answers

August 1, 2008 at 6:29 PM


Hi friend,


I am sending again code but i am using JDBC database and i created database file like this

my table name is Image and filed name is

id, imgName and image

i am sending running program.


<%@ page language="java" session="true"
import= "
java.awt.image.BufferedImage,java.io.ByteArrayOutputStream,java.io.InputStream,java.sql.Blob,java.sql.Connection,
java.sql.ResultSet,javax.swing.ImageIcon,java.sql.*" %>

<%
try
{
try
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
}
catch(ClassNotFoundException e)
{ System.out.println(e);
}
String url = "jdbc:mysql://192.168.10.211:3306/";;
String db = "amar";
String userName ="amar" ;
String password ="amar123" ;
Connection con;
con = DriverManager.getConnection(url+db,userName,password);
String query = "SELECT image from Image where id = 7";
out.println(query);
ResultSet rs = con.createStatement().executeQuery(query);
if(rs.next()) {
byte[] bytearray = new byte[4096];
int size=0;
InputStream image;
image = rs.getBinaryStream(1);
response.reset();
response.setContentType("image/gif");
while((size=image.read(bytearray))!= -1 ){
response.getOutputStream().write(bytearray,0,size);
}
response.flushBuffer();
image.close();
rs.close();
}
}
catch (Exception exc)
{ System.out.println(exc);
}

%>

--------------------------------------------------------------

Read for more information.

http://www.roseindia.net/jsp/

Thanks.



Related Tutorials/Questions & Answers:
How to display images in jsp ffrom sqlserver2000 - JSP-Servlet
How to display images in jsp ffrom sqlserver2000   These code u sent is till not displaying the image in jsp from sqlserver2000. what table... for more information. http://www.roseindia.net/jsp/ Thanks
Retrview image from sqlserver2000 and display in jsp - JSP-Servlet
Retrview image from sqlserver2000 and display in jsp  How to retreview image from sqlserver2000 to jsp? pls give the solution i am using Tomcat 4 Database Server:SQLSERVER2000 pls give the full coding  Hi friend
Advertisements
How to display multiple images in jsp
How to display multiple images in jsp  <%@ page import="java.io....()); System.out.println("st-7 "+brr); // display the image response.setContentType("image... "); } } catch (Exception e) { out.println("Unable To Display image"); out.println
how to display multiple images on browser
how to display multiple images on browser  i want to display multiple images on brower including string values from sql database using jsp
how to display multiple images on browser
how to display multiple images on browser  i want to display multiple images on brower including string values from sql database using jsp
Reporting tool for sqlserver2000 with java or jsp
Reporting tool for sqlserver2000 with java or jsp  Hi to all ,Is there any Reporting tool to make report from sqlserver2000 as a database and implementing it to java or jsp   Hi, You can use Jasper Report
display records with images problem - JSP-Servlet
, Display images from database to visit ... http://www.roseindia.net/jsp...display records with images problem  hello, i am developing HR... with a unique id. Also i wrote i jsp that link to servlet in order to display
how to upload and download images using buttons in jsp?
how to upload and download images using buttons in jsp?  how to upload and download images using buttons in jsp
how to save images in oracle using JSP
how to save images in oracle using JSP  how to insert images in oracle using jsp
how to save images in oracle using JSP
how to save images in oracle using JSP  how to insert images in oracle using jsp
how to retrieve images from database to jsp?
how to retrieve images from database to jsp?  Hi sir,i want to stores images along with the name and price with database and retrieve it on jsp.and... display the elaborated image in th next page.plz help me in coding.its vey
jsp images
jsp images  hi I had done a demo application using jsp. And i tried to display some images which is located in the server folder. It has done by using the IP address path of that image folder.. It has been success full in IE
How to store multiple images in folder and images path in database at a time using jsp?
How to store multiple images in folder and images path in database at a time using jsp?  I wanna browse multiple images in one form and store them in one folder and their path into datrabase
How to upload multiple images in java(struts) using jsp?
How to upload multiple images in java(struts) using jsp?  I have jsp... using this jsp,but i want to CollegeAction class and CollegeForm class how to do...;COLLEGE INFORMATION :</legend> <pre> Gallery Images: <input type
How to upload multiple images in java(struts) using jsp?
How to upload multiple images in java(struts) using jsp?  I have jsp... using this jsp,but i want to CollegeAction class and CollegeForm class how to do...;COLLEGE INFORMATION :</legend> <pre> Gallery Images: <input type
How to upload multiple images in java(struts) using jsp?
How to upload multiple images in java(struts) using jsp?  I have jsp... using this jsp,but i want to CollegeAction class and CollegeForm class how to do...;COLLEGE INFORMATION :</legend> <pre> Gallery Images: <input type
How to upload multiple images in java(struts) using jsp?
How to upload multiple images in java(struts) using jsp?  I have jsp... using this jsp,but i want to CollegeAction class and CollegeForm class how to do...;COLLEGE INFORMATION :</legend> <pre> Gallery Images: <input type
How to upload multiple images in java(struts) using jsp?
How to upload multiple images in java(struts) using jsp?  I have jsp... using this jsp,but i want to CollegeAction class and CollegeForm class how to do...;COLLEGE INFORMATION :</legend> <pre> Gallery Images: <input type
How to upload multiple images in java(struts) using jsp?
How to upload multiple images in java(struts) using jsp?  I have jsp... using this jsp,but i want to CollegeAction class and CollegeForm class how to do...;COLLEGE INFORMATION :</legend> <pre> Gallery Images: <input type
How to upload multiple images in java(struts) using jsp?
How to upload multiple images in java(struts) using jsp?  I have jsp... using this jsp,but i want to CollegeAction class and CollegeForm class how to do...;COLLEGE INFORMATION :</legend> <pre> Gallery Images: <input type
How to upload multiple images in java(struts) using jsp?
How to upload multiple images in java(struts) using jsp?  I have jsp... using this jsp,but i want to CollegeAction class and CollegeForm class how to do...;COLLEGE INFORMATION :</legend> <pre> Gallery Images: <input type
How to upload multiple images in java(struts) using jsp?
How to upload multiple images in java(struts) using jsp?  I have jsp... using this jsp,but i want to CollegeAction class and CollegeForm class how to do...;COLLEGE INFORMATION :</legend> <pre> Gallery Images: <input type
how to display the email message in jsp
how to display the email message in jsp  hi every one .. i am new from this industry please help me to display the email message in jsp page please send me sample code
Problem with display of images in applets - Applet
Problem with display of images in applets  Hi all, When I run this program, the appletviewer window is showing no output (i.e. no image). I'm..., this); } } --------------------------------------- Display image in Java Applet
how to display data from database in jsp
how to display data from database in jsp  how to display data from database in jsp
Blob images - JSP-Servlet
Blob images  Hi sir how can i retrieve blob images from database using jsp from mysql  Hi Friend, Please visit the following link: http://www.roseindia.net/jsp/retrieve-image.shtml Hope that it will be helpful
display multiple images from postgres database in jframe
display multiple images from postgres database in jframe  i just want to display multiple images on jframe by firing a query on postgres database
Display Multiple Images in jscrollpane using Java Jpanel
Display Multiple Images in jscrollpane using Java Jpanel  Browse and Display multiple images in vertical view of java jscrollpane using jpanel
regarding images in jsp
regarding images in jsp  Hi, When I am trying to display an image in jsp, i am getting the image of bar charts in webroots/jspchart/web/jspbarchart.jsp.. But actually I am not getting any image in the browser.. Can any one help
upload images - JSP-Servlet
upload images  How to write the jsp code to upload images into database.   Hi Friend, The link we have provided you will allow you...://www.roseindia.net/jsp/upload-insert-csv.shtml Thanks
How to Display jrxml file on JSP page???
How to Display jrxml file on JSP page???  I made jrxml file using jasper report but how to display on jsp page?? i tried lot but still i didnt find out solution.so pls help me as soon as possible
 

 

 

DMCA.com