Jun 18, 2003 #1 harwooddale Programmer Joined Feb 7, 2003 Messages 40 Location GB Hi, Is it possible to run an application, say FTP from within Oracle?
Jun 18, 2003 #2 lseboek1 Technical User Joined Nov 20, 2002 Messages 6 Location CH Yes it's possible via external procedure call: example: shell_command.c: #include <stdio.h> #include <stdlib.h> #include <string.h> void sh(char *); void sh( char *cmd ) { int num; num = system(cmd); } ---------------- gcc -G -c shell_command.c ld -r -o shell_command.so shell_command.o In oracle: CREATE or replace LIBRARY shell_command_lib is 'FULL_PATH_TO_MY_SCRIPTS/shell_command.so'; / create or replace procedure shell_command(cmd IN char) as external name "sh" library shell_command_lib language C parameters (cmd string); / Then you can call the shell_command procedure from whatever PL/SQL. e.g begin shell_command('my_shell_script'); end; The exetrnal_procedure_listener must run: sample listener.ora: external_procedure_listener = (ADDRESS_LIST = (ADDRESS= (PROTOCOL=IPC) (KEY= extproc_key) ) ) sid_list_external_procedure_listener= (sid_list= (sid_desc= (sid_name=extproc_agent) (oracle_home=/ora/oracle/817) (ENVS = LD_LIBRARY_PATH=FULL_PATH_TO_MY_SCRIPTS) (program=extproc) ) ) Upvote 0 Downvote
Yes it's possible via external procedure call: example: shell_command.c: #include <stdio.h> #include <stdlib.h> #include <string.h> void sh(char *); void sh( char *cmd ) { int num; num = system(cmd); } ---------------- gcc -G -c shell_command.c ld -r -o shell_command.so shell_command.o In oracle: CREATE or replace LIBRARY shell_command_lib is 'FULL_PATH_TO_MY_SCRIPTS/shell_command.so'; / create or replace procedure shell_command(cmd IN char) as external name "sh" library shell_command_lib language C parameters (cmd string); / Then you can call the shell_command procedure from whatever PL/SQL. e.g begin shell_command('my_shell_script'); end; The exetrnal_procedure_listener must run: sample listener.ora: external_procedure_listener = (ADDRESS_LIST = (ADDRESS= (PROTOCOL=IPC) (KEY= extproc_key) ) ) sid_list_external_procedure_listener= (sid_list= (sid_desc= (sid_name=extproc_agent) (oracle_home=/ora/oracle/817) (ENVS = LD_LIBRARY_PATH=FULL_PATH_TO_MY_SCRIPTS) (program=extproc) ) )