请高手指点一下这样才能将所有记录的内容显示出来!
请高手指点一下这样才能将所有记录的内容显示出来!
Connection conn =null;
Statement stmt=null;
ResultSet rs=null;
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn=DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/first","root","110541129");
stmt=conn.createStatement();
rs=stmt.executeQuery("select * from picture where name='车2'");
while(rs.next())
{
Blob b = rs.getBlob(2);
int size =(int)b.length();
out.print(size);
InputStream in=b.getBinaryStream();
byte[] by= new byte[size];
response.setContentType("image/jpeg");
OutputStream sos = response.getOutputStream();
int bytesRead = 0;
while ((bytesRead = in.read(by)) != -1) {
//out.print(new String(by));
sos.write(by, 0, bytesRead);
}
in.close();
sos.flush();
}
%>
展开