0

I have a job in my oracle database and for some reason i need to call it within my java application.
Anyone has an idea to tell me how?
I already tried:
execute DBMS_SCHEDULER.RUN_JOB('My_job_name')
DBMS_SCHEDULER.RUN_JOB('My_job_name')
{DBMS_SCHEDULER.RUN_JOB('My_job_name')}
{execute DBMS_SCHEDULER.RUN_JOB('My_job_name')}
by CallableStatement but none of them worked.
Any help would be appreciated

Arash moradabadi
  • 230
  • 1
  • 12
  • What error messages have you received when trying these? Have you tried the command in Toad or SQL*Plus to make sure you have the syntax and privs correct on the database side? – Tad Harrison Jun 12 '19 at 14:55

2 Answers2

1

Just wrap the scheduler call in a BEGIN-END block:

CallableStatement callStmt = conn.prepareCall(
  "BEGIN DBMS_SCHEDULER.RUN_JOB(job_name => 'My_job_name'); END;");
callStmt.executeUpdate();
dilino
  • 97
  • 1
  • 3
  • 8
0

Do you have the priviliges do run it? if yes i guess that the job must be disabled Run the following procedure to enable it :

exec DBMS_SCHEDULER.ENABLE (My_job_name);

And let me know what you got.