Wednesday, April 28, 2010

Configuring Quartz.Net with an ADO.Net Job Store (AdoJobStore) – Part 2

NOTE: I'm now blogging at and not updating this blog anymore. For information on the latest version of Quartz.Net, visit me there.

In Part 1 we set up our database so that we could use it as a job store for Quartz.Net. Now, we need to set up our scheduler job store properties to use said database. Here are the most common properties and values that need to be set in order to get the scheduler to use the database as its job store:
Property Value
quartz.jobStore.type Quartz.Impl.AdoJobStore.JobStoreTX, Quartz
quartz.jobStore.dataSource default
quartz.jobStore.tablePrefix QRTZ_
quartz.jobStore.clustered true
quartz.jobStore.lockHandler.type Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz
quartz.jobStore.driverDelegateType Quartz.Impl.AdoJobStore.SqlServerDelegate, Quartz
quartz.dataSource.default.connectionString Server=localhost;Database=youeverseethefly;Uid=brundle;Pwd=fly;
quartz.dataSource.default.provider SqlServer-20
quartz.jobStore.useProperties true
You can set these properties in your config file, but the specific file will depend on whether you are using the default configuration file or something else. If you are using the default (distribution) settings, these properties will go in your quartz.config file.
That’s all there is to setting up an AdoJobStore. Start up your service and take a look at the event log to see if the scheduler started up correctly.


Anonymous said...

Hello Jay,

Thank you for your brilliant blog.

you know what's coming next!

I am trying to use the AdoJobStore and the overwrite-existing-jobs property in the Quartz_jobs.xml does not seem to take effect ( works okay for the RAMJobstore - as expected). I.e the jobs in the database are not being over written by what has been configured in the Quartz_jobs.xml

I get the following line in the logs "Not overwriting existing job:SampleJob.MyJob" and the scheduler continues to use the configuration that was persisted in the initial run.

I've tried to restart the quartz scheduler service to no avail.

The only thing that worked was to truncate the tables in the Quartz tables from the DB and re-start the Quartz scheduler. Clearly, this may not be a workable solution when the app goes live !

I am using the Quartz.dll (version Marko seems to have fixed the problem against a Jira that was raised in 2009[QRTZNET-153]. The fix should be available in the Quartz dll .. but it is does not work for some reason.

Any ideas why this could be ?

Thank you,

J said...

I'll have to take a look at why this is happening. I've been looking mostly at the 2.0 code lately so give me until next week to get back to you.

J said...

Apparently the fix never made it into the codebase. Perhaps the fix was made only for the 2.0 version.