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.......

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
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
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
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
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
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
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
link hibernate to MS ACCESS database
link hibernate to MS ACCESS database  how to link hibernate to ms access database instead of sql database
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
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
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
Get values from JSP pages - JSP-Servlet
Get values from JSP pages  I have welcome.jsp in which it has... to another JSP page?Do you want to use database to add column values or you want... I need to get the value of those column names(First Name, Second
get info from mysql using jsp and servlet
get info from mysql using jsp and servlet  HELLO! I wanna create a jsp page which able to let me get its name, phone and other info by asking the user to key in their email address from mysql database by using servlet and jsp too
how to get data from checkboxes - JSP-Servlet
how to get data from checkboxes  hi, i got list of tables on screen... need to get only those tables to the next page where i can get list of columns to that selected tables. please help me.  hi, we can get the selected
how to get a values from processRecord - JSP-Servlet
how to get a values from processRecord  dear sir, i have a problem in getting a values from java to jsp.Here jsp is used to read a excel sheet...... thanks in advance.. //in jsp FileInputStream fin = new FileInputStream
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 retrieve image from database using jsp and servlet?
How to retrieve image from database using jsp and servlet?  Hi, I am trying to find code for displaying the image from database in a JSP page. How to retrieve image from database using jsp and servlet
fetch record from oracle database using jsp-servlet?
fetch record from oracle database using jsp-servlet?  how can i fetch data from oracle database by using jsp-servlet. i'm using eclipse, tomcat server and oracle database and creating jsp pages and also using servlet
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
Connecting to Database from a hyperlink in JSP - JSP-Servlet
Connecting to Database from a hyperlink in JSP  How can I connect to database by clicking on a hyperlink in a JSP Page.Can you please give me sample... which is connect to database using jdbc database
Populate dropdown menu from database using jsp and servlet
Populate dropdown menu from database using jsp and servlet  please i need code to populate dropdown menu from mysql database using jsp and servlet. thanks
retriving image from database - JSP-Servlet
retriving image from database  how to retrive image from mysql database by using servlet programming  Hi Friend, Please visit the following link: http://www.roseindia.net/servlets/retreiveimage.shtml Thanks
getting values from database - JSP-Servlet
JSP code separately.If it will not display database values then try your code in Servlet. Thanks...getting values from database  I tried the following code abc.html
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
data are not display in JSP from database - JSP-Servlet
data are not display in JSP from database   i want to finding some data through a SQL query from SQL server database to a JSP page based on some... of this jsp page. like.. School Result and three request parameters 'class', 'from
retrive the employee details with image from mysql database using jsp servlet
retrive the employee details with image from mysql database using jsp servlet  im doing the web project to retrive the employee profile which i stored in the database using jsp servlet then want to show the result in the next jsp
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 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
not able to get values from jsp file - JSP-Servlet
not able to get values from jsp file  hi thanks for u feedback, her am sending the file jsp and servlet but in the servlet file am not able to get... remove encrtype from form tag its work fine please go through the file
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
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 get a numeric value from a message - JSP-Servlet
how to get a numeric value from a message  dear sir, I have to get a numeric value from a following message matter i.e Dear [1...(); strMatter = massMailDetails.getMatter(); now i have to get only values
How to get jSon object in servlet from jsp - JSP-Servlet
How to get jSon object in servlet from jsp  How to get jSon object in servlet from jsp? In jsp page i have written: var sel...; var url = 'ConfigurationServlet?ActionID=Configuration_Physical_Get
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
connec to database - JSP-Servlet
connec to database  Need code to connect the application to database. I have developed the application JSP and Servlet
how to get a values from a multipart/form-data - JSP-Servlet
how to get a values from a multipart/form-data  Dear sir , I...: From: Matter : Status... ,matter,file field values but not status and from field i am getting null
How to get the values from the Combo Box - JSP-Servlet
How to get the values from the Combo Box   Sir, Actually i am getting the values in the combo box from table.I want what ever... in their respective text box. e.g suppose i select ram values from the combo box and its
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
ArrayList from JSP to Servlet - JSP-Servlet
ArrayList from JSP to Servlet  Hi, I have an arraylist declared in a scriplet in a jsp page. how can i access the arraylist in a servlet which...)); %> How can I access this arraylist in a servlet. How
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
server database connection - JSP-Servlet
" in that case how we will get the database connection   Hi Friend, which database you want to use Oracle or MS Access? Thanks... ODBC For Oracle}","scott","tiger"); But how to get the connection from
Acees data from database using combo box - JSP-Servlet
Acees data from database using combo box  please let me how i access the data from database when i select combo box combo2 having values Arts... value 11 or 12, otherwise combo box combo2 remain hide. Here is JSP's files
simple web appllication to insert, update or display from database - JSP-Servlet
in which we can insert, update or delete data from database. i can also display database content on jsp page. please send complete code. thank you mani saurabh...simple web appllication to insert, update or display from database  
get information from database
get information from database  get information from database   Please visit the following links: http://www.roseindia.net/sql/mysql-table/mysql-php-select.shtml http://www.roseindia.net/sql/mysql-example/select

Ads