Calling Operating system command from Database

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Adnan

    Calling Operating system command from Database

    I want to read a file list in a directory from a database procedure. I
    m using Oracle 9i Release 2. How to do??? I don't want to user
    external procedures. I know it can be done through java stored
    procedure. Any other solution like a single command......Ja va code is
    still ok...

    Regards,

    Adnan
  • Rauf Sarwar

    #2
    Re: Calling Operating system command from Database


    Originally posted by Adnan
    I want to read a file list in a directory from a database procedure. I
    m using Oracle 9i Release 2. How to do??? I don't want to user
    external procedures. I know it can be done through java stored
    procedure. Any other solution like a single command......Ja va code is
    still ok...
    >
    Regards,
    >
    Adnan

    There isn't a prebuilt "single command" solution. You have to write a
    java stored procedure and a PLSQL wrapper procedure.

    Read java docs and Look at list() or listFiles() functions in
    "File" interface in "java.io" API. Goto http://tahiti.oracle.com
    for Oracle docs.

    Hint:
    import java.io.*;
    public class foo {
    public static String getFileList (String dirname) {
    ....
    File dir = new File(dirname);
    String[] entries = dir.list();
    ...
    }
    }

    Regards
    /Rauf Sarwar

    --
    Posted via http://dbforums.com

    Comment

    Working...