Using Stored Procedure as a job in Quartz.Net

503 views
Skip to first unread message

Ria

unread,
May 23, 2008, 11:01:29 AM5/23/08
to Quartz.NET
Hello,

I am building an application which requires scheduling a lot of jobs,
calling one job from another job etc. I think Quartz.job could help me
in that. All my jobs are in the form of SQL Server Stored Procedures
which have to be executed at regular intervals. How can I schedule a
Stored Procedure in Quartz.Net ?
Any help in this will be appreciated.

ThankYou,
Ritu

Marko Lahma

unread,
May 23, 2008, 11:06:33 AM5/23/08
to quar...@googlegroups.com
Hi,

If you want to use Quartz for this you can create a simple job that
reads from job data map the name of procedure to run (I'm assuming
your procedures don't take differing parameters) and then just use
plain ADO.NET to call it.

But there's always the SQL Server Agent that you can use to schedule
jobs to run, it supports transact SQL and thus you can call your
procedure straight from the script. This might also be an option to
consider.

-Marko

Ria

unread,
May 23, 2008, 11:45:19 AM5/23/08
to Quartz.NET
Thank You for this input.
Is there an example you can provide as to how this can be done using
job data map and ado.net ?
Secondly how the application using quartz.Net should be deployed so
that the job is run as scheduled. The schedule time can be changed
from the front end.

Thank You,
Ritu
> > Ritu- Hide quoted text -
>
> - Show quoted text -

Marko Lahma

unread,
May 23, 2008, 12:01:20 PM5/23/08
to quar...@googlegroups.com
Job data map example here:
http://quartznet.sourceforge.net/tutorial/lesson_3.html . So you just
need to put needed info there - maybe connection string, procedure
name etc. Connection can also naturally be read from App.config etc.

If you want persisted and modifiable schedules you should look at
AdoJobStore, there's an example of that part of the distribution. If
you have fixed set of jobs it should be mostly maintenance of triggers
then. If you want scheduler run without the front-end you should
probably use windows service for that.

-Marko

Ria

unread,
May 23, 2008, 12:16:18 PM5/23/08
to Quartz.NET
ThankYou Marko.
This is good information for me to start this project.

On May 23, 12:01 pm, "Marko Lahma" <marko.la...@gmail.com> wrote:
> Job data map example here:http://quartznet.sourceforge.net/tutorial/lesson_3.html. So you just
> >> - Show quoted text -- Hide quoted text -

Ria

unread,
Jun 3, 2008, 12:06:10 PM6/3/08
to Quartz.NET
I have been able to build a UI to schedule the job and the triggers.
The data for the jobs and triggers is all present in the Quartz_
tables. Now I am in the process of building a windows service which
will use Quartz.Net to schedule the job.
I am using the schedular.start() in my windows service to start the
job but the trigger is not firing i.e I do not see the Next_Fire_Time
for the trigger incrementing.
Where am I going wrong ?

Ria
> > >> > Ria Hide quoted text -

Marko Lahma

unread,
Jun 3, 2008, 4:08:02 PM6/3/08
to quar...@googlegroups.com
Hi Ria,

There are too many things that can be a bit off. You need to check
your configuration and maybe set Quartz logging to debug level to
gather more information about what is happening.

-Marko

Joe Ho

unread,
Jun 5, 2008, 7:39:18 AM6/5/08
to quar...@googlegroups.com
Hi

I got the basic logging for my window service which host Quartz Jobs. i am using log4net. how can i config quartz to log details log?

Joe Ho
Edenbrook Ltd
88 Wood Street
London
EC2V 7RS

Tel +44 020 7868 1688
Fax +44 020 7868 1788
mob +44 (0)7946 544 861
email joe...@edenbrook.co.uk <mailto:joe...@edenbrook.co.uk>
Registered in England and Wales
Company Number 4136328

www.edenbrook.co.uk

DISCLAIMER

This message has been sent via the Internet. Internet communications are not secure against interception or modification. Edenbrook Ltd therefore cannot guarantee that this message has not been modified in transit. This message and any files transmitted with it are confidential and intended solely for the use of the addressee. If you have received this message in error please notify the sender and destroy your copies of the message and any attached files.

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________

winmail.dat

Marko Lahma

unread,
Jun 6, 2008, 8:01:10 AM6/6/08
to quar...@googlegroups.com
Hi,

Here's example how to delegate logging to log4net:
http://fisheye3.atlassian.com/browse/quartznet/trunk/server/Quartz.Server.Service/App.config?r=218
. After that it's just log4net configuration magic.

-Marko

Joe Ho

unread,
Jun 6, 2008, 11:53:25 AM6/6/08
to quar...@googlegroups.com
thanks Marko

i have tried this and it works really well. but i was hoping to have more control on the logging. we use Spring.Net and Nhibernate in our application, the logging config log all the details. i was hoping just to log details of jobs and triggers ..



Joe Ho
Edenbrook Ltd
88 Wood Street
London
EC2V 7RS

Tel +44 020 7868 1688
Fax +44 020 7868 1788
mob +44 (0)7946 544 861
email joe...@edenbrook.co.uk <mailto:joe...@edenbrook.co.uk>
Registered in England and Wales
Company Number 4136328

www.edenbrook.co.uk

DISCLAIMER

This message has been sent via the Internet. Internet communications are not secure against interception or modification. Edenbrook Ltd therefore cannot guarantee that this message has not been modified in transit. This message and any files transmitted with it are confidential and intended solely for the use of the addressee. If you have received this message in error please notify the sender and destroy your copies of the message and any attached files.

________________________________

winmail.dat

MarkPollack

unread,
Jun 6, 2008, 6:58:51 PM6/6/08
to Quartz.NET
Hi,

Quartz is using the Common.Logging project to provide a portability
layer for its logging. It is the same one Spring.NET uses. You can
read how to configure Common.Logging here

http://netcommon.sourceforge.net/doc-latest/reference/html/index.html

There is a section specifically for log4net.

Cheers,
Mark

Ria

unread,
Jun 11, 2008, 4:16:30 PM6/11/08
to Quartz.NET
Hi Marko,

Thanks for all your help which you have been providing :)
One last question hopefully. In your earlier reply you had mentioned
about using ADO to call the Stored Procedure ( my job) . Where exactly
the call to this Stored Procedure should be made. Is it in
BeginTransaction() method ?

Thank You in advance.

Regards,
Ria

Marko Lahma

unread,
Jun 11, 2008, 4:47:30 PM6/11/08
to quar...@googlegroups.com
Hi Ria,

I think you need just basic ADO.NET procedure calling code, there's a
sample here: http://www.codeproject.com/KB/cs/simplecodeasp.aspx . So
in your job's Execute method just run the needed procedure calling
code.

Hope this helps,

-Marko

Reply all
Reply to author
Forward
0 new messages