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



Home Answers Viewqa JSP-Servlet how to store and retrieve image from database
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


ramesh
how to store and retrieve image from database
3 Answer(s)      2 years and 3 months ago
Posted in : JSP-Servlet


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


Advertisement
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
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
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. Can u tel me hw to do? I am trying n able to do also
Advertisements
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 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 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 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... through the following link How To Store Image Into MySQL Using Java
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 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# thanks in advance...store and retrive image from the database  please provide me
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 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
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
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 ?????/  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 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
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
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...' of database 'mahendra'. Structure of table 'save_image' First create database named
<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 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 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
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 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...(); String strQuery = "select image from data where id="+id; ResultSet rs
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 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
 

 

 

DMCA.com