String sql = "select * from CC_FGBACKPIC where nssbid = 3"; PreparedStatement ps = con.prepareStatement(sql); ResultSet rs = ps.executeQuery();
... ·½·¨Ò»£º Java code:
InputStream is = rs.getBinaryStream("kppic"); File file = new File("D:/e.bmp"); OutputStream os = new FileOutputStream(file); byte [] bt = new byte[1024]; int len; while ((len = is.read(bt)) != -1) { os.write(bt, 0, len); } os.close(); is.close();
·½·¨¶þ£º Java code:
InputStream is = rs.getAsciiStream("KPPIC"); FileOutputStream fos = new FileOutputStream(new File("d:/e.jpg")); int c = 0; while((c = is.read()) != -1) { fos.write(c); } fos.close(); is.close();