dearsenthil you have asked for getting an imagefrom the database please see this code ..................> import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.sql.*; public class getblob extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { res.setContentType("image/gif"); ServletOutputStream out = res.getOutputStream(); try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con =DriverManager.getConnection ("jdbc:odbc:venu","scott","tiger"); Statement st=con.createStatement(); System.out.println("before satement gets executed"); ResultSet rs=st.executeQuery("select image from images where sno=101"); System.out.println("query executed"); rs.next(); InputStream is=rs.getBinaryStream(1); byte[] buf = new byte[4 * 1024*1024]; int bytesRead; while ((bytesRead = is.read(buf)) != -1) { out.write(buf, 0, bytesRead); } is.close(); st.close(); con.close(); //System.out.println(rs.getInt(1)); } catch (Exception e1) { out.println(e1.toString()); } //fis.close(); } } ------------------------------------------------- ------_NextPart_000_0159_01C0AC83.BEEBEDC0 Content-Type: text/plain; name"teste2.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename"teste2.txt" Hi I have the code to insert a blob and retrieve it. insblob.java---inserts blob into database import java.sql.*; import java.io.*; class insblob { public static void main (String args []) throws SQLException { Connection conn = null; // Load the Oracle JDBC driver try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); conn =DriverManager.getConnection("jdbc:odbc:cip","",""); } catch (ClassNotFoundException e) { System.out.println(e); return; } // Connect to the database // You must put a database name after the @ sign in the connection URL. // You can use either the fully // specified SQL*net syntax or a short cut // syntax as ::. The example uses the short cut syntax. try { //= DriverManager.getConnection ("jdbc:oracle:oci8:@america","danko","dino"); File pictFile = new File("c:/windows/Hlpbell.gif"); int pictFilelen = (int)pictFile.length(); InputStream fPict = new FileInputStream(pictFile); PreparedStatement myStmt = conn.prepareStatement("insert into imgblob values(?,?)") ; myStmt.setInt(1,102); myStmt.setBinaryStream(2,fPict, pictFilelen); int res = myStmt.executeUpdate(); System.out.println("image inserted"); myStmt.close(); conn.close(); } catch (Exception ex) { System.out.println(ex); System.out.println(ex.getMessage()); } } } image.java--retrieves the blob import java.sql.*; import java.io.*; import javax.servlet.*; import javax.servlet.http.* ; public class image extends HttpServlet { Connection conn= null; Statement st = null ; ResultSet rs = null; public void init(ServletConfig sc) throws ServletException { super.init(sc); try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); System.out.println("driver loaded"); conn =DriverManager.getConnection("jdbc:odbc:cip","",""); System.out.println("connected to database"); }catch (Exception e){ System.out.println(e); } } public void doGet(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException { res.setContentType ("image/gif"); ServletOutputStream outstream = res.getOutputStream(); try { st = conn.createStatement (); rs = st.executeQuery ("select * from imgblob "); while (rs.next()) { InputStream instream = rs.getBinaryStream("img"); // Create temporary buffer for read byte[] buffer = new byte[5*1024]; // length of bytes read int length = 0; // Fetch data while ((length = instream.read(buffer)) != -1) { outstream.write (buffer, 0, length); } //buffer=null; } } catch(SQLException e){ System.out.println("hooo"+e); } } } i hope this serves ur request bye pramod