JDBC中BLOB/long raw字段的读写
来源:互联网 发布:nginx shtml 编辑:程序博客网 时间:2024/05/17 23:45
一、读long raw字段二、写long raw字段三、读BLOB字段
byte[] bytes = SourceResultSet.getBytes("图像数据")
preparedStmt.setBinaryStream(i, new ByteArrayInputStream(bytes),size);
oracle.sql.BLOB blob = (oracle.sql.BLOB)resultSet.getBlob(i);
if (blob!=null)...{
InputStream is = blob.getBinaryStream();
byte[] bytes = new byte[BUF_SIZE]; //BUF_SIZE应该大于该字段最大的长度
int totalSize = is.read(bytes); //总共读入的字节数
is.close();
}
if (blob!=null)...{
InputStream is = blob.getBinaryStream();
byte[] bytes = new byte[BUF_SIZE]; //BUF_SIZE应该大于该字段最大的长度
int totalSize = is.read(bytes); //总共读入的字节数
is.close();
}
四、写BLOB字段
如果要同时写入多个字段,先把BLOB字段设为 empty_blob()
从下面的结果集中得到要更新的BLOB字段:targetBlobselect 图像数据 from targetTable where id = 100 for update
oracle.sql.BLOB targetBlob = (oracle.sql.BLOB)TargetResultSet.getBlob("图像数据");
把字节数组写入,关闭输出流,setBlob设置BLOB字段
OutputStream out = targetBlob.getBinaryOutputStream();
out.write(bytes);
out.close();
updateBlobStmt.setBlob(1, targetBlob);
return updateBlobStmt.executeUpdate();
out.write(bytes);
out.close();
updateBlobStmt.setBlob(1, targetBlob);
return updateBlobStmt.executeUpdate();
- JDBC中BLOB/long raw字段的读写
- oracle里面的long,long raw,raw,clob,blob区别
- oracle里面的long,long raw,raw,clob,blob区别 .
- JDBC读取Oracle LONG RAW类型字段
- oracle中读写blob字段的问题
- AE中读写Blob字段
- Oracle 中LONG RAW BLOB CLOB类型介绍
- JDBC读取Oracle LONG RAW类型字段 显示图片
- Oracle:在程序中对RAW类型字段的读写
- 对oracle中BLOB字段读写的总结
- 对oracle中BLOB字段读写的总结
- oracle中读写blob字段的问题解析
- JAVA读写Oracle中blob字段
- jdbc中如何处理Oracle BLOB字段
- jdbc中如何处理Oracle BLOB字段
- jdbc中如何处理Oracle BLOB字段
- jdbc中如何处理Oracle BLOB字段
- jdbc中如何处理Oracle BLOB字段
- 用VC编程阻止全局钩子的加载
- function, new function, new Function
- ASCII 编码
- JScript中的undefined和"undefined"
- JS类定义原型方法的两种实现的区别
- JDBC中BLOB/long raw字段的读写
- 软件开发技术趋势分析
- 诺基亚面试题目
- 了解Ruby on Rails
- 杂七杂八
- JavaScript语句可以不以;结尾的烦恼
- 保护你的DLL和Code不被别人使用 -C#篇
- Develop Log - Qooxdoo Widget
- 为SQLite数据库添加加密功能