Home » Developer & Programmer » JDeveloper, Java & XML » creating and writing a filein a java procedure which is activated when trigger fired.
creating and writing a filein a java procedure which is activated when trigger fired. [message #90888] Sun, 18 November 2001 18:06 Go to next message
samba
Messages: 1
Registered: November 2001
Junior Member
Hi,
i wrote java class and i load it into oracle8i
database . Steps i followed are:

1) Created the Java class containing the public static
method.
2) uploaded that into the database using loadjava
utility.
3) Create one procedure which will call that static
method
4) Created the trigger with calling the procedure
created in step3.

my java class is like this
----------------------------
import java.io.*;

public class data
{

public static void writeFile() throws SQLException
{
FileWriter fout = new FileWriter("file.txt");

fout.write("some data");
fout.close();
}
}

But when the trigger fired I got one error :
-------------------------------------------
java.security.AccessControlException: the Permission
(java.io.FilePermission
file.txt write) has not been granted by
dbms_java.grant_permission to
SchemaProtectionDomain(SAMBA|PolicyTableProxy(SAMBA))
ORA-04088: error during execution of trigger
'SAMBA.sample_tri'

Then I called :

call
dbms_java.grant_permission('SAMBA','java.io.FilePermission','test.txt','writ
e');
commit;

Again when trigger fired file is not created.
IT is giving that permission denied.

what i can do, please help me.

samba.

----------------------------------------------------------------------
Re: creating and writing a filein a java procedure which is activated when trigger fired. [message #90901 is a reply to message #90888] Sun, 25 November 2001 23:15 Go to previous message
eirik
Messages: 4
Registered: November 2001
Junior Member
Did you remember to add a UTL_FILE_DIR permission in init.ora ?

You get a security exception if not...

Brgds,
Eirik Olimstad

----------------------------------------------------------------------
Previous Topic: Need some suggestion on the frontend
Next Topic: Re: Simple Java question
Goto Forum:
  


Current Time: Thu Apr 18 11:03:43 CDT 2024