oracle数据显示图片显示不出来问题
用servlet实现的添加和显示图片功能,能够添加成功,但是显示一直出问题:大体思路是:添加成功后,有listPhone这个servlet跳转到显示图片页面,下面是listPhoneDao代码:
public class ListPA {
	private Connection conn;
	private PreparedStatement prep;
	private ResultSet res;
	 public void list(ServletOutputStream os){
		  String photo=null;
		   conn=DBConnectionManager.conn();
		   String sql="select photo from photo where id=1";
		   try {
			prep=conn.prepareStatement(sql);
			   res=prep.executeQuery();
			   while(res.next()){
				   Blob blob=res.getBlob(1);
				   InputStream is=blob.getBinaryStream();
				   byte[] by=new byte[1024];
				   int i;
				   for(i=is.read(by);i!=-1;){
				  os.write(by,0,i);
				}	 				   }
				   os.flush();
			   }
		} catch (
SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (
IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		//return photo;
	   }
}
listPhoneServlet代码:
public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws 
ServletException, IOException {
ListPA ad=new ListPA();
   response.reset();
   try {
	ad.list(response.getOutputStream());
} catch (Exception e) {
	// TODO Auto-generated catch block
	e.printStackTrace();
}
}
但是一直报错:Client
AbortException:  
java.net.SocketException: Connection reset by peer: socket write error
	at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:358)
	at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:434)
	at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:349)
	at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:381)
	at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:370)
	at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:89)
	at com.fan.dao.ListPA.list(ListPA.java:36)
	at com.fan.servlet.ListPhoto.doGet(ListPhoto.java:22)
	at com.fan.servlet.ListPhoto.doPost(ListPhoto.java:37)
	at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)