sanatankumar
to get picture from ms access database by jsp-servlet....
1 Answer(s)      4 years and 2 months ago
Posted in : JSP-Servlet

I have inserted a picture in ms access data base,,,how we can retrieve that picture by using jsp.......

Advertisement
View Answers

March 10, 2011 at 10:33 AM


<%@page import="java.sql.*,java.io.*"%>
<%
try{
    InputStream sImage;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
           Connection con = DriverManager.getConnection("jdbc:odbc:student");
File imgfile = new File("C:/rose.jpg");
      FileInputStream fin = new FileInputStream(imgfile);
      PreparedStatement pre = con.prepareStatement("insert into user(name,address,image) values(?,?,?)");
      pre.setString(1,"A");
      pre.setString(2,"Delhi");
      pre.setBinaryStream(3,fin,(int)imgfile.length());
      pre.executeUpdate();
     out.println("Inserting Successfully!");
      pre.close();
      Statement st=con.createStatement();
      ResultSet rs=st.executeQuery("SELECT image FROM user WHERE id = 3");
      if(rs.next()) {
byte[] bytearray = new byte[1048576];
int size=0;
sImage = rs.getBinaryStream(1);
response.reset();
response.setContentType("image/jpeg");
while((size=sImage.read(bytearray))!= -1 ){
response.getOutputStream().write(bytearray,0,size);
}
}
 con.close();
}     
catch(Exception ex){
out.println("error :"+ex);
}
%>









Related Tutorials/Questions & Answers:
to get picture from ms access database by jsp-servlet....
to get picture from ms access database by jsp-servlet....  I have inserted a picture in ms access data base,,,how we can retrieve that picture by using jsp
How to Open Picture From M.S. Access Database using Java Servlet ?
How to Open Picture From M.S. Access Database using Java Servlet ?  Hi all my Friends I have below code which insert a picture into M.S. Access Database But i m still not able to open this picture through Java using M.S. Access
Advertisements
inserting picture in ms access
inserting picture in ms access  hi i am sanatan, how to insert picture in ms access by jsp.   <%@page import="java.sql.*,java.io.*"%> <% try{ InputStream sImage; Class.forName("sun.jdbc.odbc.JdbcOdbcDriver
MS Access - JSP-Servlet
stepts 1.to configure the ms access database to your system control panel...MS Access  hello sir, i want to use MS.Access as my database..so my problem is how to connect MS Acces database with servlets ... thank you
Updating Ms Access Database using jsp - JSP-Servlet
Updating Ms Access Database using jsp  Hi I am new to jsp and I am trying to update a record in an access database. I only want to update part of the record because the other columns already have data. When I use Update
How save,get picture from database in my jsp page?
How save,get picture from database in my jsp page?  How i save picture in db after browsing it,and also how i get it on my other jsp page
How to insert or delete records in MS access database using jsp - JSP-Servlet
How to insert or delete records in MS access database using jsp  Hi friends please provide me a solution that i insert or delete record from a database using java server pages. I used the microsoft access 2003 database. PlZ
link hibernate to MS ACCESS database
link hibernate to MS ACCESS database  how to link hibernate to ms access database instead of sql database
Java to insert picture to database - JSP-Servlet
Java to insert picture to database  Hi Guys, Please assist me on this. Below is the code I wanted to use to insert picture into Ms Sql server 2000 but after the insertion, I got this in the database (back-end
Migrating from mysql to MS Access
Migrating from mysql to MS Access  Hi I am hoping for some help I need to write a conversion program (SQL statements) to import existing data in a MYSQL database to a MS Access database. any suggestions would be appreciated
jsp or sevlet and html form to send picture to database - JSP-Servlet
that contains his picture to database. What I need are html page for the form that will browse for the picture, jsp or servlet that the info from html will go...jsp or sevlet and html form to send picture to database  Hello guys
how to delete specified coloumn from database(MS Access) by using windows application
how to delete specified coloumn from database(MS Access) by using windows application  how to delete specified coloumn from database(MS Access) by using c# windows application
how to access the MS ACCESS database with java
how to access the MS ACCESS database with java   how to access the MS ACCESS database with java how can we insert,delete,update,search records of ms access with java   Java MS Access database connectivity Follow
how to insert values from jsp into ms access
how to insert values from jsp into ms access   how to insert values using jsp into ms access database
How To Display both image and data into Swing JTable which is retrieved from ms access database
How To Display both image and data into Swing JTable which is retrieved from ms access database  So far this is my code how can i display both image and data from database.. while (rs.next()) { Vector row = new Vector(columns
how to access the MS ACCESS database with java - Java Beginners
how to access the MS ACCESS database with java  how can we insert,delete,update,search records of ms access with java
how to retreive values from MS Access Database based on the values entered in textbox values in jsp file
how to retreive values from MS Access Database based on the values entered... in MS Access Database. the table structure is Sno JobName ProgramName Problem... Solution field from database and display in the textbox of the jsp.   1
how to connect to MS access database in JSP?
how to connect to MS access database in JSP?  how to connect to MS access database in JSP? Any seetings/drivers need to be set or installed before... DSN will get created. 6) Restart your server and run your jsp code. Here is your
How to Validate JRadioButton and How to Save data from JRadioButton to MS Access Database - Java Beginners
How to Validate JRadioButton and How to Save data from JRadioButton to MS Access Database  Hello Sir I want Store Corse Type that contains Two JRadioButton I want Store Information from JRadioButton to MS Access Database, and I
applet connected to table in MS Access database
applet connected to table in MS Access database   i have connected my java code with the MS access database and this is my code, can anyone tell me...:DRIVER={Microsoft Access Driver (*.mdb)};DBQ=faltu.mdb"; // String url = "jdbc
ms access
ms access  how to delete the autonumber from ms access using java delete code
how i conditional access the data from database using combo box. - JSP-Servlet
access the data from database when i select class 11 0r 12. Here is JSP file...how i conditional access the data from database using combo box.   i...="+cla+"&&from_year="+y1+"&&to_year="+y2+"&&school="+sch); alert(sch+" "+cla+ " "+y1
show null point Exception """ while trying 2 load a JComboBox"" data is fetch from database ms-access
from database ms-access  import javax.swing.*; import java.awt....,"connected to database"); stat=con.createStatement(); String ss="select name from data..."); JOptionPane.showMessageDialog(null,"connected to database
show null point Exception """ while trying 2 load a JComboBox"" data is fetch from database ms-access
from database ms-access  import javax.swing.*; import java.awt....,"connected to database"); stat=con.createStatement(); String ss="select name from data..."); JOptionPane.showMessageDialog(null,"connected to database
show null point Exception """ while trying 2 load a JComboBox"" data is fetch from database ms-access
from database ms-access  import javax.swing.*; import java.awt....,"connected to database"); stat=con.createStatement(); String ss="select name from data..."); JOptionPane.showMessageDialog(null,"connected to database
How To Connect MS ACCESS 2003 Database in C Program with Graphics.
How To Connect MS ACCESS 2003 Database in C Program with Graphics.  How To Connect MS ACCESS 2003 Database in C Program with Graphics
Ms Access
Ms Access   How to get query for Primary key from MsAccess?   SELECT column_name FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE table_name = 'data';   SELECT column_name FROM INFORMATION_SCHEMA.KEY_COLUMN
Upload the picture - JSP-Servlet
the picture in the database a webpage and i want to show that picture another page. what i... is a simple example which uploads employee profile data into database and also...://www.roseindia.net/jsp/file_upload/employee_upload_profile_image.shtml Thanks RoseIndia
ACCESS DATABASE FROM HTML
ACCESS DATABASE FROM HTML  I want to access sql 2008 database in html page without help of ADODB connection.. because if access through ADODB means there is a security problem. so, Access database in html page(client side
MS ACCESS
MS ACCESS  i have done : Insert form data into MS database...) Restart your server and run your jsp/servlet code and created a table...-> data sources. 2)Click Add button and select the driver Microsoft Access
MS ACCESS
MS ACCESS  i have done : Insert form data into MS database...) Restart your server and run your jsp/servlet code and created a table...-> data sources. 2)Click Add button and select the driver Microsoft Access