一.写入BLOB
1.先在blob中插入empty_blob()
2.获得对刚刚插入记录的引用
BLOB blob = (BLOB) rs.getBlob("你的blob字段名称");
3.写入
OutputStream out = blob.getBinaryOutputStream();
out.write(ENCYPWD);//注意这里
二.读出BLOB
1.blob = rs.getBlob("你的blob字段名称");
、
2.InputStream is = blob.getBinaryStream();
int length = (int) blob.length();
byte[] buffer = new byte[length];
is.read(buffer);
is.close();
3.你有了is就随便处理了
比如说输出到一个文件
FileOutputStream fo = new FileOutputStream(filename);//数据到的文件名
fo.write(buffer);
fo.close();
1.先在blob中插入empty_blob()
2.获得对刚刚插入记录的引用
BLOB blob = (BLOB) rs.getBlob("你的blob字段名称");
3.写入
OutputStream out = blob.getBinaryOutputStream();
out.write(ENCYPWD);//注意这里
二.读出BLOB
1.blob = rs.getBlob("你的blob字段名称");
、
2.InputStream is = blob.getBinaryStream();
int length = (int) blob.length();
byte[] buffer = new byte[length];
is.read(buffer);
is.close();
3.你有了is就随便处理了
比如说输出到一个文件
FileOutputStream fo = new FileOutputStream(filename);//数据到的文件名
fo.write(buffer);
fo.close();