Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML Register Schema

Status
Not open for further replies.

demigod

IS-IT--Management
Jun 25, 2003
7
GB
Hi
Can some tell me whats the matter with the following regsiter schema code , I have been stuck on it for days


Register XML Schema...
old 2: dbms_xmlschema.registerSchema('&schema_url',FileToClob('C:\wkdir\fea\src\xml\faq.xsd'),
new 2: dbms_xmlschema.registerSchema('BEGIN
*
ERROR at line 1:
ORA-22288: file or LOB operation FILEOPEN failed
No such file or directory
ORA-06512: at "SYS.DBMS_LOB", line 504
ORA-06512: at "FAQDEMO.FILETOCLOB", line 10
ORA-06512: at line 2




PROMPT Creating FileToClob function...
------------------------------------------------------------
CREATE OR REPLACE FUNCTION FileToClob(fname VARCHAR2) RETURN CLOB IS
fclob CLOB;
theBFile BFILE;
BEGIN

DBMS_LOB.CREATETEMPORARY(fclob,false,DBMS_LOB.SESSION);

theBFile := BFileName('XMLDIR',fname);

DBMS_LOB.fileOpen(theBFile);

DBMS_LOB.loadFromFile(fclob, theBFile, dbms_lob.getLength(theBFile));
DBMS_LOB.fileClose(theBFile);

printClobOut(fclob);

RETURN fclob;
END FileToClob;
/
show errors;
 
You should pass only file name (without path). Path is defined by DIRECTORY parameter. The directory should be created first by CREATE DIRECTORY.

Regards, Dima
 
Hi there

Sorry I did try that too without the directory path but it still failed, I have tried all sorts of things but the outcome is the same , could it be permissions on the file or directory.

Thks

Mike
 
Yes, but in most cases this occurs on Unix or with network drives. In your case I'd suggest to thoroughly test your CREATE DIRECTORY statement and file name.

Regards, Dima
 
dima

Thanks for your reply, this is the setup i have got , oracle database on linux and the faq.xsd is on a xp box where i am running the client stuff from.

could it be one of the reason why it can find the file!

I will do what u say , try out the create directory statement first , will let u know

thks for your help
Mike Desouza
 
Hi dima

that statement worked fine
old 1: CREATE DIRECTORY XMLDIR AS '&xmldir'
new 1: CREATE DIRECTORY XMLDIR AS 'c:\wkdir\fea\src\xml'

Directory created.

Any ideas what i should try next

Thks

Mike
 
CREATE DIRECTORY doesn't raise error even if no such directory found. That's why you thought it was created.
In fact this statement maps SERVER filesystem directory to Oracle one. If you pass the name of your LOCAL directory, Oracle will search for the path specified on SERVER and probably will not find it :)

Regards, Dima
 
hi dima

sorry for being a pain , I know defintely the directory 'c:\wkdir\fea\src\xml' exists on XP, so what do u suggest I do , if there anyway i can make it simpler.

Mike
 
Did you read my post? The directory in Oracle is created for directory on SERVER, not client. Oracle knows nothing about your client PC, even if it runs XP :). So you may either move that file to Linux or mount your LOCAL XP DIRECTORY to Linux via SAMBA (it should be accessible to Linux account your Oracle is launched by).

Regards, Dima
 
thks Dima

Sorted it out , read your previus post but could not understand what to do , the latter one did , so i did what u said and it worked .

thanks for all your help

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top