I am trying to set date and time from database in Quartz Schedular but is unable to do so. Please help me out.
Here is my code:
public class CroneScheduler {
public CroneScheduler() throws Exception {
SchedulerFactory sf = new StdSchedulerFactory();
Scheduler sche = sf.getScheduler();
sche.start();
JobDetail jDetail;
jDetail = new JobDetail("Newsletter", "NJob", MyJob.class);
//"0 0 12 * * ?" Fire at 12pm (noon) every day
//"0/2 * * * * ?" Fire at every 2 seconds every day
CronTrigger crTrigger = new CronTrigger("cronTrigger", "NJob", "0/2 * * * * ?");
sche.scheduleJob(jDetail, crTrigger);
}
}
If the version of
quartz
is 1.7.2,then you can use below code:If the version of
quartz
is newer than 1.7.2,you can use below code: