Take the 2-minute tour ×

I'm creating a scheduler using Quartz.NET in the current project. In my case all the jobs that has to be created are stored in a single table and there is a separate UI where I can add new jobs or edit existing jobs. My question is how I can feed all the jobs in the table to the Quartz scheduler? Do I want to query for all the jobs in the table and iterate through it creating the JobDetails and Trigger objects? Is there any better way in this case?

In this case do I want to use a RAMJobStore or AdoJobStore?

share|improve this question

1 Answer 1

up vote 11 down vote accepted

you can use AdoJobStore.
Quartz.net will use a set of tables with prefix QRTZ_ (you can change it if you want) in your database to stored jobs, triggers and status of these objects.
I guess you want to have a table in your DB where you're going to keep extended information about your schedules, right?
You won't access Quartz.net table directly cause you will use the APIs provided by Quartz.net.

The process to create a job detail and trigger is straightforward and described very well in the tutorials.

To configure your app to use the AdoJobStore you have to specify few informations in your app.config file. Here is an example:

    <add key="quartz.scheduler.instanceName" value="myApp" />
    <add key="quartz.scheduler.instanceId" value="MyApp" />
    <!-- Configure Thread Pool -->
    <add key="quartz.threadPool.type" 
                  value="Quartz.Simpl.SimpleThreadPool, Quartz" />
    <add key="quartz.threadPool.threadCount" value="10" />
    <add key="quartz.threadPool.threadPriority" value="Normal" />
    <!-- Configure Job Store -->
    <add key="quartz.jobStore.misfireThreshold" value="60000" />
    <add key="quartz.jobStore.type" 
                  value="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz" />
    <add key="quartz.jobStore.useProperties" value="true" />
    <add key="quartz.jobStore.dataSource" value="default" />
    <add key="quartz.jobStore.tablePrefix" value="QRTZ_" />
    <add key="quartz.jobStore.lockHandler.type"  
              value="Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz" />
    <add key="quartz.dataSource.default.connectionString" 
        value="Server=SVSQL2008;Database=QuartzNet1;Trusted_Connection=True;" />
    <add key="quartz.dataSource.default.provider" value="SqlServer-20" />

There are few things to keep in mind depending if you're hosting Quartz.net in a web application or a service or winform app. The best approach is to create SchedulerFactory and Scheduler as singleton. You can gather some more infos here.


First of all you have to create Quartz.net tables (see Step 1) and then you'll have to create a few indexes for optiomization (see bottom of the page).

Since you're going to submit your jobs using the web app but you're not using that app for the quartz.net events (triggers) you don't need to start the scheduler. There are few steps to follow on this side:

you have to change the thread pool type to ZeroSizeThreadPool

<add key="quartz.threadPool.type" 
                   value="Quartz.Simpl.ZeroSizeThreadPool, Quartz" />

and you have to define your StdSchedulerFactory and Scheduler singleton. You can start during the application (asp.net) bootstrap.

You're never going to start the Scheduler (your windows service is going to use that).

Another thing to remember is you're going to need share your job between your web and your windows service, so it would be better to keep it in a separate assembly.

You mentioned you're storing some infos in one of your table. You still need to have to submit your jobs and trigger which will be persisted in Quartz.net tables.

share|improve this answer
Thanks for your reply. I've a single table in database that stores all the jobs information for the business. The scheduler is running in Windows service and through an ASP.NET application jobs are added to this table or edited. So how I can use Quartz.NET in this case? Whenever a job is added or edited the scheduler has to be updated. –  Dnana Jun 28 '11 at 10:20
@Dnana: is that your windows service or Quartz.net windows service? –  LeftyX Jun 28 '11 at 10:22
.net windows service. i'm not sure which one is better in this case. –  Dnana Jun 28 '11 at 10:24
@Dnana: Right, I've chosen the same solution. I've got a web app (UI) which submits jobs and a custom windows services which is responsible for Quartz.net triggers. –  LeftyX Jun 28 '11 at 10:28
If I use the Quartz tables then I can't directly insert or update jobs rgt? –  Dnana Jun 28 '11 at 10:32

Your Answer


