This week's giveaway is in the Programmer Certification (OCPJP) forum.
We're giving away four copies of Java Mock Exams (software) and have David Mayer on-line!
See this thread for details.
Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Rpt : Image Inesertion some1 check this code

akilan kandaswamy
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use PreparedStatement instead of Statement when retrieving data from BLOBs or CLOBs.
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!