MOD_PLSQL Download Fails With HTTP-500 ORA-22285: Non-Existent Directory Or File For GETLENGTH Operation

(Doc ID 754471.1)

Last updated on FEBRUARY 16, 2017

Applies to:

Oracle HTTP Server - Version 9.0.2.0.1 to 10.1.4 [Release 9iAS to AS10gR2]
z*OBSOLETE: Microsoft Windows Server 2003
z*OBSOLETE: Microsoft Windows 2000
z*OBSOLETE: Microsoft Windows XP
Microsoft Windows 2000Microsoft Windows XPMicrosoft Windows Server 2003


Symptoms

Downloading a file with MOD_PLSQL on an Application Server 10.1.2.3.0 environment on Windows 2003 fails with an ORA-22285 / ORA-22288 error if the file sits in a remote disk, referenced in the PLSQL code using Microsoft Windows UNC syntax (i.e. \\<hostname>\<shared directory>), e.g.:

create or replace directory MY_DIR AS '\\MyRemotePC\mySharedDir';


The following test PLSQL procedure is used as an example:


procedure test1 is
image_name varchar2(100);
mime_type varchar2(100);
f_lob bfile;
bfile_length number;
begin
image_name :='abc.jpg';
mime_type :='image/jpeg';
f_lob := bfilename('MY_DIR', image_name);

bfile_length := dbms_lob.getlength(f_lob);
owa_util.mime_header(mime_type, false);
htp.p('content-length: '||bfile_length);
-- htp.p('content-disposition: attachment; filename="'||image_name||'"');
owa_util.http_header_close;
wpg_docload.download_file(f_lob);
end;



The problem does not reproduce downloading a file stored in a local file system

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms