File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases 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 REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
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
jQuery in Action, 3rd edition