27

How do you set up a jobstore with Quartz.net. The tutorial they have on the site is not that of help for me.

In this page though there are steps http://quartznet.sourceforge.net/tutorial/lesson_9.html I am not able to get how to set this one

org.quartz.jobStore.type = Quartz.Impl.AdoJobStore.JobStoreTX, Quartz 

Thanks

walen
  • 7,103
  • 2
  • 37
  • 58
acadia
  • 1,607
  • 5
  • 18
  • 19
  • 1
    There is some more info on this here: http://stackoverflow.com/questions/3821804/ado-net-with-quartz-net/21786658#21786658 – Adam Seabridge Feb 14 '14 at 18:18

1 Answers1

48

Here's an adapted example of programmatic configuration from Quartz.NET's example 13:

NameValueCollection properties = new NameValueCollection();

properties["quartz.scheduler.instanceName"] = "TestScheduler";
properties["quartz.scheduler.instanceId"] = "instance_one";
properties["quartz.jobStore.type"] = "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz";
properties["quartz.jobStore.useProperties"] = "true";
properties["quartz.jobStore.dataSource"] = "default";
properties["quartz.jobStore.tablePrefix"] = "QRTZ_";
// if running MS SQL Server we need this
properties["quartz.jobStore.lockHandler.type"] = "Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz";

properties["quartz.dataSource.default.connectionString"] = "Server=(local);Database=quartz;Trusted_Connection=True;";
properties["quartz.dataSource.default.provider"] = "SqlServer-20";

// First we must get a reference to a scheduler
ISchedulerFactory sf = new StdSchedulerFactory(properties);
IScheduler sched = sf.GetScheduler();

You can also achieve the same thing with properties file based approach (the .config file).

Update for Quartz 3.1 and later

You can also use fluent Microsoft DI registration API introduced in Quartz.NET 3.1 if you have Microsoft dependency injection in use. See configuration guide for details.

Marko Lahma
  • 6,586
  • 25
  • 29
  • Marko thanks for your response. I created all the tables but in the QRTZ_Triggers table the start_Time and End_Time are big int columns how to I specify a Start time as 11:30 or 14:25? And after getting the instance of Scheduler do I need to loop through the triggers from the database?? or do u have any example for that please – acadia Sep 29 '09 at 19:43
  • You should do all changes via scheduler interface, you should not change the table contents directly in database. Triggers and job details are persisted in database if you use JobStoreTX. – Marko Lahma Oct 01 '09 at 13:21
  • I am trying to figure out how to get the code from ClusterExample.cs from example13 in to a config file for my Quartz Server so there is no programmatic setup and I can't seem to figure it out. Is it even possible? – Snowy Dec 02 '10 at 01:19
  • 2
    You should be able to list all these properties using section in config file and using stadard pattern. Then you don't need programmatic configuration at all. – Marko Lahma Dec 02 '10 at 08:12
  • Marko: What do you mean by the "scheduler interface?" I have downloaded the solution but there is no GUI project. The solution has a two class library projects, a console app and a windows service. As far I can tell, the console just starts the same process that the service would. Thanks for your help with this. –  Nov 27 '09 at 07:27
  • 2
    There is some more useful info on this here: http://stackoverflow.com/questions/3821804/ado-net-with-quartz-net/21786658#21786658 – Adam Seabridge Feb 14 '14 at 18:18