views:

32

answers:

1

I'm using Quartz.NET with a database, i.e. ADO.NET. Problem is, when my jobs are created, they are not being saved to the database at all. Have I configured everything right? I am using SQL Server Express, and the path to my database is 'chris\sqlexpress.Quartz.dbo'.

Relevant parts of config file:

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=Quartz;Trusted_Connection=True;";
quartz.dataSource.default.provider = SqlServer-20
quartz.jobStore.useProperties = true

Scheduler initilisation and job addition:

ISchedulerFactory schedService = new StdSchedulerFactory();
IScheduler sched = schedService.GetScheduler();

JobDetail jobDetail = new JobDetail("1", "1", typeof(copyJob));
jobDetail.JobDataMap["initialPath"] = initpath;
jobDetail.JobDataMap["targetPath"] = targetpath;
jobDetail.JobDataMap["regex"] = regex;

CronTrigger trigger = new CronTrigger("trigger1", "group1", "1", "1", TextBox4.Text);
sched.AddJob(jobDetail, true);
DateTime ft = sched.ScheduleJob(trigger);
ft = TimeZoneInfo.ConvertTimeFromUtc(ft, trigger.TimeZone);

Response.Write(string.Format("{0} has been scheduled to run at: {1} and repeat based on expression: {2}", jobDetail.FullName, ft.ToString("r"), trigger.CronExpressionString));
A: 

Right, worked it out for anyone that needs help. My connection string was wrong, and I had to hard code the server information in as in Example 13 in the Quartz.NET examples. It's a great framework :)

Chris