oracle读bfile,在fileopen时候ORA-22285报不存在

id和bfile两个字段的表,先写入

 CREATE or replace DIRECTORY tmpdir AS '/usr/local/oracle/bfile1';
 insert into bfile1.bfiletest values(3,bfilename('TMPDIR','2.jpeg'));

然后读的时候

BFILE bfile = (BFILE) rs.getObject(i + 1);
bfile.openFile();
int length = (int) bfile.length();
InputStream instream = bfile.getBinaryStream();
byte[] buffer = new byte[length];
instream.read(buffer);

TMPDIR要大写

你可能感兴趣的:(oracle)