关于显示数据库图片的问题
try{String wpId=request.getParameter("wpId");
if(wpId!=null){
ResultSet rs=cn.executeQuery("select wp_yangpin1 from wp_tbl where wp_id='"+wpId+"'");
//Blob image=(Blob)wupin.getWpYangpin1();
while(rs.next()){
ServletOutputStream sout = response.getOutputStream();
InputStream in = rs.getBinaryStream("wp_yangpin1");
byte b[] = new byte[0x7a120];
for(int i = in.read(b); i != -1;)
{
sout.write(b);
//将缓冲区的输入输出到页面
in.read(b);
}
sout.flush();
//输入完毕,清除缓冲
sout.close();
}
}
}catch(Exception e){
System.out.println(e);
}
抛出异常:ClientAbortException: java.net.SocketException: Connection reset by peer: socket write error