File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and the fly likes Rpt : Image Inesertion some1 check this code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Rpt : Image Inesertion some1 check this code" Watch "Rpt : Image Inesertion some1 check this code" New topic

Rpt : Image Inesertion some1 check this code

akilan kandaswamy

Joined: Feb 26, 2001
Posts: 4
hai ,
I tried to retrieve an image from MSACCESS using the following code im getting an Exception IOException:MEthod not implemented some1 pls help me, how to enter an imae into an DataBase?

import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class GetImage4 extends HttpServlet
Connection con;
Statement st;
ResultSet rs;
public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
PrintWriter out=res.getWriter();
con=DriverManager.getConnection("jdbc dbc:sasi");
rs=st.executeQuery("SELECT * FROM IMAGE");;

BufferedInputStream bis=new BufferedInputStream(rs.getBinaryStream(2));
byte[] bb=new byte[4 * 1024];
int dd=rs.getInt(1);

int len=0;
catch(Exception e)
{ System.out.println(e);e.printStackTrace(); }
David Freels
Ranch Hand

Joined: Feb 01, 2001
Posts: 102
Use PreparedStatement instead of Statement when retrieving data from BLOBs or CLOBs.
I agree. Here's the link:
subject: Rpt : Image Inesertion some1 check this code
Similar Threads
Retreving PDF File from Database using Java
Could Anyone correct my Error with JDBC
Problem with servlet reading images in database!
displaying image from database
How to give Servlet response from Tag Handler class?