简体   繁体   中英

trying to export java source code from an Oracle database

I am trying to export the source for a java object from an 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

even though I am running as System. Any ideas what is causing this and how I can get this to work.

Having investigated a bit more it worked when running as sysdba and also as the user that owns the objects. Unfortunately I am making a program to dump out the java objects in an Oracle database and I can't really force my users to be sysdba or the object's owner.

Is there any way I can stop this error?

When you connect use "as sysdba" option. I don't get ModifyPermissionException when I login as sysdba. See my actions below. The ORA-29532 I am getting is becuse I simply don;t have the Java class in my database. let me know if it 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>

I am facing the same problem, but after a few searches on google I solve it. Probably will 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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM