java操作blob问题
shihp 2009-07-20 05:48:23 我用java程序将图片存入oracle数据库的blob字段,但读出来存成图片文件后,windows不能预览,用画图和图片浏览器不能打开,但用photoshop能打开.
这是写入数据库的代码:
String sqlRs = "select zp from ts_jgzp where zpdm='" + phName +
"' and xh='"+(tot+1)+"' for update";
rs = stmt.executeQuery(sqlRs);
if (rs.next()) {
oracle.sql.BLOB blob = (oracle.sql.BLOB) rs.getBlob(1);
outStream.write(photo);
outStream.flush();
outStream.close();
log = "0^0^";
}
使用plsql导出图片也是不能正常打开,只能用photoshop看