Re: Help: run a host program from a (client) trigger
Date: 28 Jan 94 01:09:03 GMT
Message-ID: <1994Jan28.010903.26504_at_oracle.us.oracle.com>
In article <glasstetter.11.000E99B2_at_bmcwest.com> glasstetter_at_bmcwest.com (Dan Glasstetter) writes:
>In article <2hp2hd$aao_at_terminator.rs.itd.umich.edu> Liang Lin <llin_at_med.umich.edu> writes:
>>How do I execute a VMS program from an Oracle trigger?
>>Is there any way to write data into a disk file from a trigger?
>>Liang Lin
>We are having the same problem....
>How do we execute a Server command (VAX VMS) from the Client application
>(Forms 4.0) ?
>The HOST command from Forms executes in DOS.
>I've tried putting the HOST command in a database procedure with no luck.
>There has GOT to be a way to do this. We need to kick off a batch job
>(on the VAX) based upon user input (in the form).
>Can anyone out there shed some light ?
>Thanks,
>Dan Glasstetter
>BMC West Corp.
>glasstetter_at_bmcwest.com
HOST() is a built-in in our 4GL tools that executes client commands (on Windows, you also have the option of using DDE.EXECUTE(), which has slightly different, but necessary-on-Windows, behavior). If you want to execute commands on the server, one way is to create a server stored procedure which is called from the client when you want to execute a host-based operating system command. You can do this from the stored procedure by using DBMS_PIPE on the server. Then you create a program on the server using Pro*3GL or OCI, which waits on the DBMS_PIPE for a message from the server. When it gets that message through the pipe, it can then execute (using the equivalent of a Unix system() or exec() call) whatever program you like on the server.
pseudo code:
stored procedure:
procedure queue_batch_job (job_to_queue in char) is
begin
...
dbms_pipe(...); -- send message through pipe to daemon
- waiting to issue command ... end;
client code in Forms:
begin
...
queue_batch_job (...); -- job to run
...
end;
daemon to run batch commands on host:
...
int main (...)
{
...
while (/* didn't get quit message in pipe */)
{
/* wait on DBMS_PIPE -- see example in manuals */
...
system (...);
...
}
...
}
See the Oracle7 reference manual for examples of how to do this and how else to use DBMS_PIPE.
Good luck!
- Dennis Moore, etcetcetc