title: unable to retrieve other information on successful retrievation of blob from database using jsp?
body: <p>I have successfully inserted details of a student and his image through .jsp program in to sql database. The problem is when I retrieve back the stored information of the student through another .jsp program only image is displaying, no other information of the student.</p>
  
  <p>Can any one help me with the codes to retrieve stored blob image and other information and display together?</p>
  
  <p>I am using oracle database 11g. </p>
  
  <p>It has student table named studdetail. it has five columns, column 1 to column 4 are varchar2 and fifth column is blob. I have successfully able to insert values through html and jsp program into the database. But the problem arises when I retrieve back the information. It only displays the image but no other information.</p>
  
  <p>Retrieve jsp code:
  show.jsp</p>
  
  <pre><code>&lt;%@page import="java.io.OutputStream"%&gt;
  &lt;%@page import="java.sql.Blob"%&gt;
  &lt;%@page import="java.sql.DriverManager"%&gt;
  &lt;%@page import="java.sql.ResultSet"%&gt;
  &lt;%@page import="java.sql.PreparedStatement"%&gt;
  &lt;%@page import="java.sql.Connection"%&gt;
  &lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
          &lt;title&gt;JSP Page&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;%
         try{
                  Class.forName("oracle.jdbc.OracleDriver");
                  Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:db","xxxx","apple");
  
  
  
                  PreparedStatement ps=con.prepareStatement("select * from studdetail");
                  ResultSet rs=ps.executeQuery();
                  while(rs.next()){ %&gt;
                  &lt;table&gt;&lt;tr&gt;&lt;th&gt;student id:&lt;/th&gt;&lt;td&gt;&lt;%=rs.getString(1) %&gt;&lt;/td&gt;&lt;/tr&gt; 
                      &lt;tr&gt;&lt;th&gt;student name:&lt;/th&gt;&lt;td&gt;&lt;%=rs.getString(2) %&gt;&lt;/td&gt;&lt;/tr&gt;
                      &lt;tr&gt;&lt;th&gt;student branch code&lt;/th&gt;&lt;td&gt;&lt;%=rs.getString(3) %&gt;&lt;/td&gt;&lt;/tr&gt;
                      &lt;tr&gt;&lt;th&gt;student contact number&lt;/th&gt;&lt;td&gt;&lt;%=rs.getString(4) %&gt;&lt;/td&gt;&lt;/tr&gt;
                      &lt;tr&gt;&lt;th&gt;students image&lt;/th&gt;&lt;td&gt;
                  &lt;%
                      Blob bl=rs.getBlob(5);
                      byte[] image=bl.getBytes(1, (int)bl.length());
                      response.setContentType("image/bmp");
                      OutputStream o = response.getOutputStream();
                      o.write(image);
                      o.flush();
                      o.close();
               }
                  %&gt;&lt;/td&gt;&lt;/tr&gt;
                  &lt;/table&gt; 
                      &lt;%
                 con.close();
             }catch(Exception e){
            out.print(e);
            }
  
       %&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>