DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: Procedure java will not create a file until i disconnect

Threaded View

  1. #1
    Join Date
    Nov 2000
    Posts
    440

    Procedure java will not create a file until i disconnect

    SORRY, THIS WAS NOT POSTED IN THE RIGHT FORUM

    I have a procedure java that execute an export command on the oracle server. It works, but only when i disconnect from my sqlplus session. Why does the export will not work right away?

    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    PL/SQL Release 10.2.0.1.0 - Production
    CORE 10.2.0.1.0 Production
    TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production



    Here is the code if you want to test it.

    create user exp identified by exp;
    grant connect to exp;
    grant create procedure to exp;
    grant create table to exp;
    grant unlimited tablespace to exp;
    connect exp/[email protected]

    create or replace and compile java source named javacmdprompt as
    import java.lang.*;
    import java.util.*;
    import java.util.Arrays;
    import java.io.*;

    public class javacmdprompt{
    public static void cmdprompt(String directory) {
    try {
    Runtime.getRuntime().exec(directory,null);
    }catch(IOException e){
    System.out.println(e);
    }
    }

    }
    /

    CREATE OR REPLACE Package My_pack as

    Procedure proc_exec_cmd_java(p_commande in varchar2) as language java name 'javacmdprompt.cmdprompt( java.lang.String )';

    End My_pack;
    /

    CREATE OR REPLACE Package body My_Pack as

    Procedure proc_exec_cmd_java is

    begin
    null;
    end proc_exec_cmd_java;

    End My_Pack;
    /

    connect sys/[email protected] as sysdba

    exec dbms_java.grant_permission( 'EXP','SYS:java.io.FilePermission', 'd:\oracle\product\10.2.0\db_1\BIN\exp', 'execute' )
    exec dbms_java.grant_permission('EXP','java.io.FilePermission', '*', 'read, write');
    exec dbms_java.grant_permission( 'EXP', 'SYS:java.lang.RuntimePermission','readFileDescriptor', '' );
    exec dbms_java.grant_permission( 'EXP', 'SYS:java.lang.RuntimePermission','writeFileDescriptor', '' );

    connect exp/[email protected]

    create table My_table(no number);

    execute My_pack.proc_exec_cmd_java('d:\oracle\product\10.2.0\db_1\BIN\exp userid=exp/exp file=d:\exp.dmp log=d:\exp.log consistent=y tables=(MY_TABLE)');

    --
    --IF I DISCONNECT I WILL SEE THE FILE D:\EXP.DMP
    --
    connect exp/[email protected]
    Last edited by steeve123; 05-12-2006 at 09:58 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width