Tries to export Java source from Oracle database

I am trying to export source for java object from oracle database using the following code.

DECLARE
  blob1 BLOB;
BEGIN
  DBMS_LOB.CREATETEMPORARY(blob1, FALSE);
  DBMS_JAVA.EXPORT_SOURCE('OBJECTNAME', 'SCHEMANAME', blob1);  
END;

      

Whenever I try to run it, I get this exception:

oracle.aurora.rdbms.ModifyPermissionException

      

although I am working as System. Any ideas what is causing this and how I can get this to work.

After researching a little more, it worked when run as sysdba and also as the user who owns the objects. Unfortunately I am making a program to dump java objects in an Oracle database and I cannot get my users to be sysdba or the owner of the object.

Can this error be stopped?

+1


source to share


2 answers


When connecting, use the "as sysdba" parameter. I am not getting ModifyPermissionException when logged in as sysdba. See my steps below. ORA-29532 I get because I just don't have, I have a Java class in my database. let me know if this worked for you.



C:\Documents and Settings\KrassimirB>sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Mar 18 15:58:10 2010

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

SQL> connect sys/oracle@orcl as sysdba
Connected.
SQL> @C:\tmp\java_export.sql
  7  /
DECLARE
*
ERROR at line 1:
ORA-29532: Java call terminated by uncaught Java exception:
java.sql.SQLException: no such java schema object
ORA-06512: at "SYS.DBMS_JAVA", line 182
ORA-06512: at line 5


SQL>

      

0


source


I faced the same problem, but after several google searches, I resolve it. Probably help someone.



DECLARE 
 b CLOB;
 c varchar2(2000);
 i integer:= 255;
begin
  DBMS_LOB.createtemporary(b, false);
  DBMS_JAVA.export_resource('<object_name>', '<schema_name>', b);
  DBMS_OUTPUT.PUT_LINE('java_resource:');
  DBMS_LOB.read(b, i, 1, c);
  DBMS_OUTPUT.PUT_LINE(c);
end;

      

0


source







All Articles