how to store and retrieve image from database

how to store and retrieve image from database

how to store and retrieve images into database(oracle) and how to retrive images from database using jsp

View Answers

July 26, 2012 at 4:34 PM

Here is a jsp code that insert and retrieve image from mysql database.

<%@page import="java.sql.*,java.io.*"%>
<%
try{
    InputStream sImage;
Class.forName("com.mysql.jdbc.Driver");
           Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
File imgfile = new File("C:/flower3.jpg");
      FileInputStream fin = new FileInputStream(imgfile);
      PreparedStatement pre = con.prepareStatement("insert into image(images) values(?)");
      pre.setBinaryStream(1,fin,(int)imgfile.length());
      pre.executeUpdate();
      System.out.println("Inserting Successfully!");
      pre.close();
      Statement st=con.createStatement();
      ResultSet rs=st.executeQuery("select images from image");
if(rs.last()){
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);
}
}
rs.close();
st.close();
con.close();
}
catch(Exception ex){
out.println("error :"+ex);
}
%>

July 30, 2012 at 4:57 PM

when i execute above code i got this error :java.sql.SQLException: [Microsoft][ODBC driver for Oracle][Oracle]ORA-01460: unimplemented or unreasonable conversion requested ,can you help me


January 8, 2013 at 12:52 PM

but its not showing the image.









Related Tutorials/Questions & Answers:
How to store and retrieve image from database in JSP?
How to store and retrieve image from database in JSP?  Hi, In one... and retrieve image from database in JSP? (adsbygoogle...: Retrieve image from database using Servlet. (adsbygoogle
how to store and retrieve image from database
how to store and retrieve image from database  how to store and retrieve images into database(oracle) and how to retrive images from database using jsp   Here is a jsp code that insert and retrieve image from mysql
Advertisements
How to retrieve image from database
How to retrieve image from database  hi........ How to retrieve image from database when it is stored. I have stored image in postgresql and want to retrieve in java form. (adsbygoogle = window.adsbygoogle || []).push
How to retrieve and display image from database in Java?
How to retrieve and display image from database in Java?  Hi, I am... to store and retrieve image from database in JSP?. Thanks... on the web page. My application is in Java/JSP. How to retrieve and display image
How to retrieve image from database in Servlet?
How to retrieve image from database in Servlet?  Hi, How to retrieve image from database in Servlet? Thanks (adsbygoogle... image from database using Servlet. Thanks (adsbygoogle
how to store and then immediately retrieve when store the image into database?
how to store and then immediately retrieve when store the image into database?  how to store and then immediately retrieve when store the image into database?   Here is a jsp code that insert and retrieve image from
How to retrieve blob image from database in JSP?
How to retrieve blob image from database in JSP?  Hello, JSP is used... the blog image from database. How to retrieve blob image from database in JSP..., Please check the tutorial Retrieve image from database using Servlet. Thanks
How to retrieve image from mysql database in JSP?
How to retrieve image from mysql database in JSP?  Hi, I need JSP same codes for learning to get image which is stored in MySQL Database. How to retrieve image from mysql database in JSP? (adsbygoogle
how we retrieve image from database
how we retrieve image from database  my code is:- $search=$_POST...;lt;/table&amp;amp;gt;"; mysql_close($con);   PHP retrieve image from mysql database: <?php mysql_connect("localhost","username","password
how to store and retrieve images int and from the database using php
how to store and retrieve images int and from the database using php  please anyone can help me in storing the images and retrieve it back from the Mysql database using php
How To Store Multilple Images In MySQL database dynamically with image uploader and then retrieve them in image gallery using java
How To Store Multilple Images In MySQL database dynamically with image uploader and then retrieve them in image gallery using java  How To Store Multilple Images In MySQL database dynamically with image uploader
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? (adsbygoogle
How to store image into database
How to store image into database  Hi, all I want to store image into database using Java. Can anyone help me that how can i store image into database... = window.adsbygoogle || []).push({}); To store image into the database
store and retrive image from the database
to store and retreive images from sql database using sql commands -how to store and retreive images from sql database using asp.net/c# (adsbygoogle...store and retrive image from the database  please provide me
how to send and retrieve image along with text to and from database
how to send and retrieve image along with text to and from database  im using app engine and i have two logics from different sources and i want... image generator. im so stumped right now and i dont know how to combine the two
How to store an image in database
How to store an image in database  Hi........... How to store an image in postgresql using a query. I mean tell me the way to store an image using datatype. I am using the datatype bytea but tell me how to insert the image
store & retrive the image from oracle database
store & retrive the image from oracle database  how can i store the image path in tha database & fetch that image from oracle database
retrieve data from mysql database and store it in a variable ?
retrieve data from mysql database and store it in a variable ?  sir... to store that data in int variable. how to do this ?   Here is an example that retrieve the integer values from the database and stored in the integer
how to retrieve data from database ?????/
how to retrieve data from database ?????/  how to retrieve data from database
how to retrieve data from database ?????/
how to retrieve data from database ?????/  how to retrieve data from database
how to retrieve data from database ?????/
how to retrieve data from database ?????/  how to retrieve data from database
how to retrieve data from database ?????/
how to retrieve data from database ?????/  how to retrieve data from database
how to retrieve image from mysql database using java and show it in HTML img tag ?
how to retrieve image from mysql database using java and show it in HTML img tag ?  how to retrieve image from mysql database using java and show it in HTML img tag
store and retrive image from database - JDBC
store and retrive image from database  how to store and retrive an image in database using java?  Hi friend, Code for store image...()); } } } For retrieve image from database visit to : http
how to retrieve data from database
how to retrieve data from database  unable to retrieve data from database using mySQL by using jsp sessions and beans for editing
Retrieve image from mysql database through jsp
Retrieve image from mysql database through jsp... to retrieve image from mysql database through jsp code. First create a database... : In the jsp code given below, image will be retrieved from database on the basis of 
<img src=""> using retrieve image from database using jsp
using retrieve image from database using jsp  how to <img src="" > tag using retrieve image from database and display in jsp
how to store and retrieve image using struts2 and hibernate integration
how to store and retrieve image using struts2 and hibernate integration  how to store and retrieve image using struts2 and hibernate integration? plz help !! thanks in advance
Retrieve image from database using servlet and display in JSP
Retrieve image from database using servlet and display in JSP  Hi, I am total new to JSP although I am learning it for the last few days. Now I want to use MySQL Database from JSP page. How to retrieve image from database using
how to use bean to retrieve data from database
how to use bean to retrieve data from database  how to use bean to retrieve data from database   poda sendru
To retrieve image from SQL Server Database - Java Server Faces Questions
To retrieve image from SQL Server Database  Sir/Madam, I am trying to retrieve image from SQL Server 2000 database in Visual Web JSF Page using... or in Image Component. please help me in retrieving and displaying image from SQL Server
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... strQuery = "select image from data where id="+id; ResultSet rs
how to insert and retrieve an image from mysql using java - Java Beginners
how to insert and retrieve an image from mysql using java  how to insert and retrieve an image from mysql using java?  Hi friend, Code...; // declare FileInputStream object to store binary stream of given image
how to store image upload path to mssql database
how to store image upload path to mssql database  hi there!!, i need help in storing the image upload path into the database. basically i just use file select to upload the image from jsp to database. however when i click submit
how to store image upload path to mssql database
how to store image upload path to mssql database  hi there!!, i need help in storing the image upload path into the database. basically i just use file select to upload the image from jsp to database. however when i click submit
how to store image upload path to mssql database
how to store image upload path to mssql database  hi there!!, i need help in storing the image upload path into the database. basically i just use file select to upload the image from jsp to database. however when i click submit
how to store image upload path to mssql database
how to store image upload path to mssql database  hi there!!, i need help in storing the image upload path into the database. basically i just use file select to upload the image from jsp to database. however when i click submit
how to retrieve image from mysql using java - Java Beginners
how to retrieve image from mysql using java  hi i am using jsf and java IDE netbean,database mysql.how to retrieve image from mysql database. please help me   Hi friend, I am sending you a link. I hope
image store in database - JDBC
to store image into database. Check at http://www.roseindia.net/servlets/insert...image store in database  Dear Deepak Sir, If I want to store image...; Inserting Image in Database Table http://www.roseindia.net/jdbc/jdbc-mysql/insert
How To Retrieve Image From From MySQL Using Java
explains you about all the steps that how to retrieve image from MySQL database... which will demonstrate you about how to retrieve image from the database...How To Retrieve Image From From MySQL Using Java In this section we
How to Retrieve Data from the database and write into excel file using Java
How to Retrieve Data from the database and write into excel file using Java  Hi, I am trying to develop an small application where i trying to retrieve Data from the database and store the details in excel file. Please can
how to store image in folder and stored image path in mysql database using JSP
how to store image in folder and stored image path in mysql database using JSP  how to store image in folder and stored image path in mysql database using JSP
How to store user name,city,state,image path into database and image into folder using jsp
How to store user name,city,state,image path into database and image into folder using jsp  How to store user name,city,state,image path into database and image into folder using jsp
Retrieve image from database using Servlet
Retrieve image from database using Servlet     ... that connects to the MySQL database and retrieves the image from the table. After... applications that retrieves the image from database. You can use this type
Unable to store the image into database
); }   Hi, Please check the thread How to Insert image into database...Unable to store the image into database  Hello, I have created below... of image. I have debug the JSP program and found that HTML form pass only image
How to store extracted values from xml in a database? - XML
How to store extracted values from xml in a database?  I want to store extracted xml values in a database... How can i store extacted xml values in a database... give me a example
How to store extracted values from xml in a database? - XML
How to store extracted values from xml in a database?  I want to store extracted xml values in a database... How can i store extacted xml values in a database... give me a example
How to display image in jsp from database using Servlet?
How to display image in jsp from database using Servlet?  Hi, How to display image in jsp from database using Servlet? Thanks... and example program at Retrieve image from database using Servlet. Thanks
how to store,retrieve,modify the data
how to store,retrieve,modify the data  hello sir ,how to store,retrieve,modify the data using the swing please help me
Image retrieve
Image retrieve  HI.. store image path/data Java Coding. ... It's supposed to take the image, store it in a directory as well as pass the image path to mysql database... Now I want to retrieve the data from directory using path

Ads