how to schedule a job on Oracle SQL developer to execute shell command "Java -Jar /Home/JavaFile.jar" each one minute?

785 views Asked by At

I would like to create an oracle job that runs every one minute to run command Java -jar /Home/file_name.jar", i am using Oracle SQL developer on windows environment to connect to Oracle DB on Linux environment.

2

There are 2 answers

0
ahmed abdelhamed On BEST ANSWER

I found a very simple way as below:

1- Connect on linux server using Putty or anything. 2-run command crontab -e 3-edit crontab by clicking i then type java command ex: * * * * * java -jar /root/filename.jar and this means that this jar file will be called each one minutes

2
vishnu sable On

step 1 you need to first load this java program in oracle so that it can run on jvm installed in oracle database... ref link http://docs.oracle.com/cd/B19306_01/java.102/b14187/chthree.htm

step 2 then you need to create function or procedure to run this java program say

CREATE OR REPLACE FUNCTION helloworld RETURN VARCHAR2 AS
    LANGUAGE JAVA NAME 'Hello.world () return java.lang.String';

step 3 then you need to create job or scheduler in oracle to run this oracle function it will internally call your java method. follow the link to create job http://docs.oracle.com/cd/E11882_01/server.112/e25494/scheduse.htm#ADMIN12381