quartznet / quartznet

Quartz Enterprise Scheduler .NET
http://www.quartz-scheduler.net/
Apache License 2.0
6.52k stars 1.69k forks source link

Quartz 2.2.4 : SybaseCronTriggerPersistenceDelegate unable to update Triggers extended properties. #217

Closed lalitnchaudhari closed 9 years ago

lalitnchaudhari commented 9 years ago

We are using Quartz 2.2.4 version. It doesn't able to execute the cron expressions on Sybase SQL Anywhere 16.0 database.

We debugged through Quartz source and found that the following query execution were resulting into exception as it wasn't able to put the command parameters for the query execution.

class name: SybaseCronTriggerPersistenceDelegate.cs method name: UpdateExtendedTriggerProperties(...)

Root Cause:- The above method executes following sql query "SqlUpdateCronTrigger" of SybaseAdoConstants.cs,

"UPDATE {0}{1} SET {2} = @triggerCronExpression, {3} = ? WHERE {4} = {5} AND {6} = ? AND {7} = ?", TablePrefixSubst, TableCronTriggers, ColumnCronExpression, ColumnTimeZoneId, ColumnSchedulerName, SchedulerNameSubst, ColumnTriggerName, ColumnTriggerGroup);

The above query wouldn't execute on Sybase SQL Anywhere database because it doesnt support the parameters declaration syntax @triggerCronExpression while execution of statements. Sybase supports only "?" for substituting parameters in query.

We tried, replaced the @triggerCronExpression with "?" and it worked fine, returned the expected result of cron. It seems like that was left unchanged while implementing Sybase delegates from Quartz.

Below is the screenshot elaborating the suggested change w.r.to base revision.

image

lahma commented 9 years ago

As Quartz does not have official support for Sybase nor the files you mention, it's pretty hard to help here. I'm unsure why you have made such drastic changes as adding db provider meta data should get you quite long way.

Please check dbprovider.properties and programmatic registering of new metadata for Sybase.