Hello,

I have created a function that registers an XML Schema in Oracle DB,
as I needed the schema registration to be executed at run time.
The function is created with no problem (I believe) in Oracle DB,
however, it seems that an error is occurred when it tries to access
the Oracle XML DB Repository where I saved the XML Schemas.

The following is the code:
Code:
Statement stmt = Database.createStatement ();

// Create the stored function
stmt.execute ("create or replace function REGISTER (url string, uri string) return NUMBER is begin DBMS_XMLSchema.registerSchema(schemaurl=>url,schemadoc=>sys.UriFactory.getUri(uri)); return 3; end;");

// Close the statement
stmt.close();

// Prepare to call the stored procedure REGISTER.
CallableStatement cstmt = Database.prepareCall ("{? = call REGISTER (?, ?)}");

// Declare that the first ? is a return value of type Int
cstmt.registerOutParameter (1,Types.INTEGER );

cstmt.setString (2, "http://localhost:8080/public/PTA.xsd");  
cstmt.setString (3, "/public/PTA.xsd");        

cstmt.execute ();

// Get the return value
int new_return = cstmt.getInt (1);

System.out.println ("The return value is: " + new_return);

// Close the statement
cstmt.close();
And the error message is as follows:

ORA-01031: insufficient privileges
ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 0
ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 147
ORA-06512: at "SYSTEM.REGISTER", line 1
ORA-06512: at line 1


.....
If any one could please share his or her thoughts regarding
the error, I would appreciate it very much.

Thanks a lot!
Hyojeong