各位大侠帮个忙,程序出错,谢谢!!(100分)

  • 主题发起人 主题发起人 susa
  • 开始时间 开始时间
S

susa

Unregistered / Unconfirmed
GUEST, unregistred user!
将图片存入到Oracle的blob中
Oracle8.17 Jbuilder5 tomcat3.2 jdk1.3 jsp程序
以下两段代码都提示以下错误
java.io.IOException: ORA-22920: 未锁定含有 LOB 值的行
第一段
BLOB blob = (oracle.sql.BLOB)lRs.getBlob("b");
File binaryFile = new File("e://paper.jpg");
System.out.println("paper.jpg length = " + binaryFile.length());
FileInputStream instream = new FileInputStream(binaryFile);
OutputStream outstream = blob.getBinaryOutputStream();
int size = blob.getBufferSize();
byte[] buffer = new byte[size];
int length = -1;
while ((length = instream.read(buffer)) != -1)
outstream.write(buffer, 0, length);
instream.close();
outstream.close();

第二段
OutputStream outstream = blob.getBinaryOutputStream();
byte[] bAtt = "e://paper.jpg".getBytes();
outstream.write(bAtt,0,bAtt.length);
outstream.close();
 
BLOB blob = (oracle.sql.BLOB)lRs.getBlob("b");
好像改为:
BLOB blob = (oracle.sql.BLOB)lRs.setBlob("b");
 
后退
顶部