Configuring Quartz to use JobStoreTx

643 views
Skip to first unread message

Jason

unread,
Aug 27, 2007, 6:45:14 AM8/27/07
to Quartz.NET
Hi All,

I wanna to test ADOJobStore..
but where I can do configuring??

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

Is there a external xml configuration file?
Thank you

Marko Lahma

unread,
Aug 27, 2007, 6:57:15 AM8/27/07
to quar...@googlegroups.com
Hi Jason,

If you want to do it programmatically (Example 13 from Quartz.NET distribution):

NameValueCollection properties = new NameValueCollection();
properties["quartz.scheduler.instanceName"] = "TestScheduler";
properties["quartz.scheduler.instanceId"] = "instance_one";
properties["quartz.threadPool.type"] = "Quartz.Simpl.SimpleThreadPool, Quartz";
properties["quartz.threadPool.threadCount"] = "5";
properties["quartz.threadPool.threadPriority"] = "Normal";
properties["quartz.jobStore.misfireThreshold"] = "60000";
properties["quartz.jobStore.type"] =
"Quartz.Impl.AdoJobStore.JobStoreTX, Quartz";
properties["quartz.jobStore.useProperties"] = "false";
properties["quartz.jobStore.dataSource"] = "default";
properties["quartz.jobStore.tablePrefix"] = "QRTZ_";
// if running MS SQL Server we need this
// properties["quartz.jobStore.selectWithLockSQL"] = "SELECT * FROM
{0}LOCKS UPDLOCK WHERE LOCK_NAME = @lockName";
properties["quartz.dataSource.default.connectionString"] =
"Server=(local);Database=quartz;Trusted_Connection=True;";
properties["quartz.dataSource.default.provider"] = "SqlServer-11";
// First we must get a reference to a scheduler
ISchedulerFactory sf = new StdSchedulerFactory(properties);

Or you can put these to quartz section of App.config, see
Quartz.Examples project's App.config.

By default Quartz initializes itself from embedded resource that's
inside Quartz assembly, but it uses RAMJobStore. You need to change
some settings if you use database other than SQL Server (connection
string, provider).

Hope this helps,

-Marko

Marko Lahma

unread,
Aug 27, 2007, 7:03:34 AM8/27/07
to quar...@googlegroups.com
Actually the example has old style lock handling, you shouldn't
declare the SQL, instead use:

properties["quartz.jobStore.lockHandler.type"] =
"Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz";

If you are running agains SQL Server.

Sorry for the confusion, I'll update the example according to this.

-Marko

Jason

unread,
Aug 27, 2007, 9:22:36 AM8/27/07
to Quartz.NET
Dear Marko,

Thank you so much~~~
I will try it at office tomorrow...
I will get back to you my result...
Thank you :)

Jason

unread,
Aug 27, 2007, 11:12:51 PM8/27/07
to Quartz.NET
Dear Marko,

Here is a feedback..

I am using code from example 13 as you said..

NameValueCollection properties = new
NameValueCollection();

properties["quartz.scheduler.instanceName"] = "TestScheduler";
properties["quartz.scheduler.instanceId"] = "instance_one";
properties["quartz.threadPool.type"] =
"Quartz.Simpl.SimpleThreadPool, Quartz";
properties["quartz.threadPool.threadCount"] = "5";
properties["quartz.threadPool.threadPriority"] = "Normal";
properties["quartz.jobStore.misfireThreshold"] = "60000";
properties["quartz.jobStore.type"] =
"Quartz.Impl.AdoJobStore.JobStoreTX, Quartz";

properties["quartz.jobStore.driverDelegateType"] =
"Quartz.Impl.AdoJobStore.MSSQLDelegate, Quartz";


properties["quartz.jobStore.useProperties"] = "false";
properties["quartz.jobStore.dataSource"] = "default";
properties["quartz.jobStore.tablePrefix"] = "QRTZ_";

properties["quartz.jobStore.clustered"] = "true";


// if running MS SQL Server we need this

properties["quartz.jobStore.selectWithLockSQL"] = "SELECT * FROM
{0}LOCKS UPDLOCK WHERE LOCK_NAME = @lockName";

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

there is one mistake..
properties["quartz.jobStore.driverDelegateType"] =
"Quartz.Impl.AdoJobStore.MSSQLDelegate, Quartz";

I can't find a delegate is called
"Quartz.Impl.AdoJobStore.MSSQLDelegate", instead of
"Quartz.Impl.AdoJobStore.StdAdoDelegate, Quartz"

If I move this property or set property to
"Quartz.Impl.AdoJobStore.StdAdoDelegate, Quartz", it works.
I am using MS SQL 2005. Therefore, should I use this property?

Marko Lahma

unread,
Aug 28, 2007, 2:15:12 AM8/28/07
to quar...@googlegroups.com
> properties["quartz.jobStore.driverDelegateType"] =
> "Quartz.Impl.AdoJobStore.MSSQLDelegate, Quartz";
> // if running MS SQL Server we need this
> properties["quartz.jobStore.selectWithLockSQL"] = "SELECT * FROM
> {0}LOCKS UPDLOCK WHERE LOCK_NAME = @lockName";

There properties should be removed and you should use just:

properties["quartz.jobStore.lockHandler.type"] =
"Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz";

This wrong configuration was unfortunately left to example after some
refactoring, I fixed it yesterday to version control.

-Marko

Jason

unread,
Aug 28, 2007, 2:22:10 AM8/28/07
to Quartz.NET
Dear Marko,

yes, I get it...
Thank you so much~

Reply all
Reply to author
Forward
0 new messages