Quartz Scheduler does not insert records into the database using JDBCStore

Configured Quartz Job,

public static void schedule(IEntity entity, Date startdate) {
    try {
        JobDetail job = JobBuilder.newJob(StatingUpdateJob.class)
                .withIdentity("UpdateStagingRecords" + entity.getId(), "StgToProduction").build();
        JobDataMap data = new JobDataMap(new HashMap<>());
        data.put("Entity", entity);
        job.getJobBuilder().setJobData(data);

        Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler();
        Date enddate = new Date();
        enddate.setTime(startdate.getTime() + 6000000);
        CronTrigger cronTrigger = TriggerBuilder.newTrigger()
                .withIdentity("UpdateStagingRecords" + entity.getId(), "StgToProduction").startAt(startdate)
                .withSchedule(CronScheduleBuilder.cronSchedule("0 0/5 * 1/1 * ? *")
                        .withMisfireHandlingInstructionDoNothing())
                .endAt(enddate).build();
        Connection connection = DBConnectionManager.getInstance().getConnection("myDS");
        System.out.println(connection);
        scheduler.scheduleJob(job, cronTrigger);
        scheduler.start();
    } catch (Exception e) {
        System.out.println("Something went wrong");
        e.printStackTrace();
    }

}

And then put quartz.properties in my class path

org.quartz.scheduler.instanceName=JavacodeGeeksScheduler
org.quartz.scheduler.instanceId=99199
org.quartz.scheduler.rmi.export=false
org.quartz.scheduler.rmi.proxy=false
org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount=3
org.quartz.context.key.QuartzTopic=QuartzPorperties
org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate
org.quartz.jobStore.tablePrefix=QRTZ_
org.quartz.jobStore.dataSource=myDS
org.quartz.jobListener.NAME.class=com.javacodegeeks.quartz.MyJobListener
org.quartz.dataSource.myDS.driver=com.mysql.jdbc.Driver
org.quartz.dataSource.myDS.URL=jdbc:mysql://localhost/test
org.quartz.dataSource.myDS.user=admin
org.quartz.dataSource.myDS.password=admin
org.quartz.dataSource.myDS.maxConnections=30

My work has been successfully created and starts correctly. But, however, job details do not fit into the database. Here are my tables

enter image description here

Not sure what else I need to configure.

+4
source share
1 answer

It is strange that the quartz data source URL is not accepted in the same way as the jdbc native URL.

When I changed jdbc:mysql://localhost/testto

jdbc:mysql://localhost:3306/test 

IT WORKED (thanks to @pringi and @Bilbo Baggins).

0
source

Source: https://habr.com/ru/post/1666480/


All Articles