继续上次的问题(有关大文件的存储)

[复制链接]
查看11 | 回复9 | 2008-1-2 17:35:53 | 显示全部楼层 |阅读模式
我是用的Oracle 10 g+winxp,使用的客户端计算机
我现在建了一张表blobtext ,想将我电脑硬盘上的"D:\640480背景.bmp"
1.我先以sys登陆进行了以下操作
create directory blob_dir1 as 'D:\';
grant read on directory blob_dir1 to zzh4818;
2.然后我又已zzh4818登陆
create table blobtext (id number primary key, col1 blob);

declare
a_blob blob;
fileloc bfile;
amount int;
dest_offset int:=1;
src_offset int:=1;
begin
insert into blobtext values (1,empty_blob());
select col1 into a_blob from blobtext where id = &id for
update;
fileloc := bfilename('blob_dir1','640480背景.bmp');
dbms_lob.fileopen(fileloc,0);
amount := dbms_lob.getlength(fileloc);
dbms_lob.loadblobfromfile (a_blob,fileloc,amount,dest_offset,src_offset);
dbms_lob.fileclose(fileloc);
commit;
end;
执行后,总是报如下错误:
ora-22285: 对不存在的目录或文件进行FILEOPEN操作
ora-06512:在“sys.dbms_LOB”,line 523
ora-06512:在line 12

后来又用存储过程来验证该文件是否存在
create or replace procedure filelist(in_bmp varchar2,voIntReturns
out int) is
vexits boolean;
vfile_length number;
vblocksize number;
begin
utl_file.fgetattr
('blob_dir1',in_bmp,vexits,vfile_length,vblocksize);
if vexits then
dbms_output.put_line(in_bmp||''||vfile_length);
voIntReturns:=1;
end if;
end filelist;
运行后还是找不到文件,但文件确实在本机上?请大哥们指出小弟的错误
这是我从书本上找到的有关大文件上传的例子,要是有哪位大哥能提供其他的大文件上传的好办法,小弟在此万分感谢
[ 本帖最后由 zzh481899 于 2007-12-25 14:33 编辑 ]
回复

使用道具 举报

千问 | 2008-1-2 17:35:53 | 显示全部楼层
目录名要大写。
回复

使用道具 举报

千问 | 2008-1-2 17:35:53 | 显示全部楼层
能说的具体点吗?谢谢
回复

使用道具 举报

千问 | 2008-1-2 17:35:53 | 显示全部楼层
bfilename('blob_dir1','640480背景.bmp')=》bfilename('BLOB_DIR1','640480背景.bmp')
回复

使用道具 举报

千问 | 2008-1-2 17:35:53 | 显示全部楼层
我把这个改过来了,但还是报下面的错误


123.gif (2.25 MB, 下载次数: 0)
下载附件
2007-12-25 15:01 上传

回复

使用道具 举报

千问 | 2008-1-2 17:35:53 | 显示全部楼层
当前用户是哪个?
回复

使用道具 举报

千问 | 2008-1-2 17:35:53 | 显示全部楼层
当前用户是zzh4818
回复

使用道具 举报

千问 | 2008-1-2 17:35:53 | 显示全部楼层
是不是文件权限有问题啊?
回复

使用道具 举报

千问 | 2008-1-2 17:35:53 | 显示全部楼层
你操作的数据库不是你本机的吧?
你的目录应该是服务器上的目录
你应该将该文件, 上传到服务器上, 才能操作
回复

使用道具 举报

千问 | 2008-1-2 17:35:53 | 显示全部楼层
用户zzh4818拥有DBA权限,而且也赋予了grant read on directory blob_dir1 to zzh4818;
还需要什么权限吗?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行