tags:

views:

197

answers:

1

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 an oracle.aurora.rdbms.ModifyPermissionException exception 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 workd when running as sysdba and also as the user that owns the objects. Unfortinatly 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?

A: 

Hi Lionel,

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>
krassib
This works but I am writing a tool to retrieve the java code in a database and I cannot force users to be sysdba. It also seems to work if you login as the user that owns the object.
Lionel