Saturday, June 9, 2012

Moving to jayvilalta.com

Hello friends.

After much debating with myself, I've decided to change blogging platforms and to start blogging at my own domain. From now on, I'll start blogging at http://jayvilalta.com/blog. Feel free to update your reader subscription to point to this new site.

One of the main reasons that I am moving my blog is that I am writing a Quartz.Net eBook. This book will include all of the topics that I have blogged about here, as well as some new ones. As I add chapters to the book, I'll also write posts about the same topics at my new blog. The book will in essence provide more in-depth information on the same topics, with the added benefit that it will al be tied together, as opposed to just small and to-the-point posts on a very specific topic.If you would like to know more about the eBook, take a look at this post, where I explain what I am up to.

If you would like to know more, please subscribe to my new blog feed or follow me on twitter: @jayvilalta.
 
I hope to see you at my new site.

J

Thursday, January 5, 2012

Using Quartz.Net 2.0 With SQL Compact 4.0

NOTE: I'm now blogging at http://jayvilalta.com/blog and not updating this blog anymore. For information on the latest version of Quartz.Net, visit me there.

Now that SQL Compact 4.0 is out, you might want to use it to as your Quartz.Net job store. Here is how to set up a Quartz.Net 2.0 scheduler with a SQL Compact 4.0 database.
Prerequisites
First, you will need to download the SQL Compact 4.0 runtime and install it on the same box that will run the Quartz.Net scheduler. You can download the runtime directly from the Microsoft site. Be sure to download the correct version for the bit-ness of your operating system. Once it is installed, we’ll configure Quartz.Net to use it as the default job store.
Configuring Quartz.Net 2.0 to Use SQL Compact 4.0 as the Jobstore
By default, Quartz.Net uses a memory based jobstore. This means that all of the jobstore information (jobs, triggers, next fire times, etc.) is lost every time that the scheduler is stopped. A database job store lets you persist this information so that the next time the scheduler starts you will not need to create all of your job and trigger information.
To use a database as the jobstore, you need to set several configuration properties. Here is a sample configuration that uses SQL Compact 4.0 as the job store:
quartz.jobStore.type = Quartz.Impl.AdoJobStore.JobStoreTX, Quartz
quartz.jobStore.driverDelegateType = Quartz.Impl.AdoJobStore.StdAdoDelegate, Quartz
quartz.jobStore.dataSource = quartzDataSource
quartz.dataSource.quartzDataSource.connectionString = Data Source=C:\quartz\quartz.sdf;Persist Security Info=False;
quartz.dataSource.quartzDataSource.provider = SqlServerCe-400

Setting Up the Database File
You will need a SQL Compact 4.0 database file in which to store the job store information. You can either create the database yourself (that’s a whole separate post itself, which I might write if there is enough interest…) or you can just download this empty database that I have already created. Once you have your database file ready to go, just change the data source for the connection string to point to the location of your database file.
Starting the Scheduler
Let’s start our scheduler so that we can see what to expect. Here’s what the console output looks like when everything works correctly:
image
If you already have a running instance of the scheduler, this post should tell you all that need to do to get your scheduler to use SQL Compact 4.0 as a job store.