Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

The requirement is to register XML schema from XSD files in Oracle 11gR2. I am using the following code:

DECLARE

BEGIN
  DBMS_XMLSCHEMA.registerSchema(
    SCHEMAURL => 'http://[...]/spin-catalog-to-bpm.xsd',
    SCHEMADOC => bfilename ('/home/joe','spin-catalog-to-bpm.xsd'),
    CSID => nls_charset_id('AL32UTF8'));
END;
/

The file spin-catalog-to-bpm.xsd is under /home/joe but when I try to register it, it gives me this error:

DECLARE
*
ERROR at line 1:
ORA-22285: non-existent directory or file for FILEOPEN operation
ORA-06512: at "SYS.DBMS_LOB", line 805
ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 131
ORA-06512: at line 3
share|improve this question

2 Answers 2

up vote 2 down vote accepted

You firstly need to create and Oracle directory.

As a user with the relevant permissions:

CREATE OR REPLACE DIRECTORY HOMEJOE AS '/home/joe';

Grant permission to the user that needs to use DBMS_XMLSCHEMA.registerSchema:

GRANT READ, WRITE ON DIRECTORY HOMEJOE TO YOURUSER;

Then register the schema, using the newly created directory:

DECLARE
BEGIN
  DBMS_XMLSCHEMA.registerSchema(
    SCHEMAURL => 'http://[...]/spin-catalog-to-bpm.xsd',
    SCHEMADOC => bfilename ('HOMEJOE','spin-catalog-to-bpm.xsd'),
    CSID => nls_charset_id('AL32UTF8'));
END;
/
share|improve this answer
    
Thanks a lot @Phil, but i am still wondering that what if i don't have access to create directory on database server. There should be a way that i can register xml schema having the xsd file at a remote location. –  Hitesh Chouhan Aug 30 '13 at 7:44

An alternative for saving an XML Schema in a location were you are able to control it is the XDB Repository:

http://docs.oracle.com/cd/B28359_01/appdev.111/b28369/xdb16fol.htm#i1042688

You can create files or select their content via XDB functionality that supports FTP/WebDAV or HTTP...

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.