C# – How to insert JOB/TRIGGER on database using Quartz.NET

cquartz-schedulerquartz.net

I´m using Quart.NET (http://quartznet.sourceforge.net/) to scheduler my jobs.
This works perfectly, I can run create job and trigger programatically but I would like to use database to store and create new triggers.

The quartz.config changed file is bellow:

quartz.jobStore.type = Quartz.Impl.AdoJobStore.JobStoreTX, Quartz
quartz.jobStore.driverDelegateType = Quartz.Impl.AdoJobStore.OracleDelegate, Quartz
quartz.jobStore.tablePrefix = QRTZ_
quartz.jobStore.dataSource = myDS
quartz.dataSource.myDS.connectionString = * my oracle connection string ****
quartz.dataSource.myDS.provider = OracleODP-20
quartz.jobStore.useProperties = true

I'm using the solution sample of Latest stable version of Quartz.NET is 2.0.1 called Quartz.Server.2010, the project play normally and execute SELECT in table a each 15 seconds (more or less), but how I INSERT data in the quartz tables?

My database has been configured using the script tables_oracle.sql

I would not execute INSERT manually in the tables, because the schema quartz of database is very dificult.

I have a other project WEB where do I would use to schedule new jobs, this project will insert the data in tables and my project server Quartz.Server.2010 will been execute.

Can I use the method CronExpression to schedule jobs a each 1 minute? like below:

Quartz.CronExpression cron = new Quartz.CronExpression("0 0/1 * 1/1 * ? *");

But i would like to put it in database, to be consumed by quartz server, and don't run in my web project.

Thanks Friends,

Best Answer

You configure your web server to use the same settings as your Quartz Server and you initialise your scheduler the same way, but don't actually start the scheduler (otherwise the jobs will start to run on the webserver).

When you are creating jobs using the API make sure you remember to call .StoreDurably()

See my answer to this SO question for more details of the syntax.

Related Topic