Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Start a program from wthin Oracle
Rauf,
As for my situation, I considered the UTL_FILE and cron (or Windows schedule job) but I dislike the idea. When the application is NOT running the cron job is still running checking to see if the file written UTL_FILE by exists. On the other hand, to make the application responsive to the end-user you need to have the cron job running and running often. This wastes resources and/or causes end-user satisfaction problems.
My approach is not to use JAVA/JNI but to use an external procedure written in C/some language to either perform the requested function or call a script to perform the function. The procedure also needs to use reentrant code (because of multiple users executing the application at the same time). This solves the above two problems because the external program executes when necessary (and only when necessary).
Bertram Moshier
Oracle Certified Professional 8i and 9i DBA
http://www.bmoshier.net/bertram
"Rauf Sarwar" <rs_arwar_at_hotmail.com> wrote in message
news:92eeeff0.0212292319.171b0b9f_at_posting.google.com...
> > I have done this with a java stored procedure. You don't need JNI. All
> > you need to do is use the java runtime object. Just create the java
> > stored procedure and call it as you would call any stored
> > procedure. You can find details about this at Tom Kytes site (or in
> > his book Expert one-on-one Oracle I think). Check out
> >
> > http://asktom.oracle.com
> >
> > Tim
>
>
> Yes you can use Runtime object to execute an OS command. But using the
> Runtime object will render the true nature of java's platform
> independence obsolete.
>
> This type of solution may be suitable for a home grown database or
> where the underlying OS will stay constant, *BUT* you may not use this
> solution for a commercial product unless you want to duplicate your OS
> commands/scripts across underlying platforms. Furthermore, what if
> database is migrated over to a different OS...then the server java
> code will have to be modified according to the OS before/after doing
> export and import...instead of *ONLY* rewriting the batch scripts.
> This to me is unnecessary overhead.
>
> IMO, If the script needs to be prompted to extract data from the
> database on every insert/update/delete (as the OP wants to do), then
> why not move the batch script sql extract code into the server. Either
> use UTL_FILE package or Java's java.io interface to write stuff to a
> file on every insert/update/delete statements. Only use underlying
> batch/shell scripts (Run as cron job) to pick up data from the file/s
> and do stuff with it. This way everything resides in the database,
> which is consistent across different platforms + it is much safer
> rather then going out from Oracle to execute an OS command against the
> database.
>
> Regards
> /Rauf Sarwar
Received on Mon Dec 30 2002 - 19:07:25 CST
![]() |
![]() |