Is it possible to run a java jar file from within an Oracle (10g) database? More specifically, I am looking to schedule an oracle job using
dbms_scheduler.create_job(...)
When run, the job would call a Java Application that performs a process involving talking to another application via HTTP, some business logic, then executing a Stored Procedure against the database using JDBC.
Normally, a chron job to do this would work fine, but the java application needs to talk to the database as a given Schema Owner. I can't store the user-credentials as plain text in the application configuration for various privacy reasons.
In short, I'm wondering if there is a way to schedule a job to execute a jar, passing in the credentials of the user who scheduled the job.
I am unfamiliar with both scheduling Oracle Jobs and running Java Code from an Oracle Database so any pointers in the right direction would be great. I haven't really been able to find any decent documentation for what I am trying to do either, although I'm sure it has to exist.
EDIT: found some documentation and it looks like I could do something like
DBMS_SCHEDULER.create_program (
program_name => 'recurring_java_task',
program_type => 'EXECUTABLE',
program_action => 'java -jar /path/to/recurring-task.jar',
number_of_arguments => 2,
enabled => TRUE,
comments => 'Program to perform cleanup');
and then use dbms_scheduler.create_job(...)
to create a job for the 'recurring_java_task'. It seems like Arguments are set using
DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE (
job_name IN VARCHAR2,
argument_position IN PLS_INTEGER,
argument_value IN VARCHAR2);
That still doesn't solve the issue of supplying connection credentials (username/password) to the java application, though.