I was finally able to setup ADOJobStore
for Sql Server, but I would also like it to work with Sqlite and I am still yet to get it to work. This is the part of my quartz.config
that I set the properties for my AdoJobStore
:
# to use the sqlite store, uncomment all of this
quartz.jobStore.type = Quartz.Impl.AdoJobStore.JobStoreTX, Quartz
quartz.jobStore.dataSource = default
quartz.dataSource.default.connectionString = Data Source=postbag-jobs.db;Version=3;Foreign Keys=ON;
quartz.jobStore.tablePrefix = QRTZ_
quartz.jobStore.clustered = false
quartz.jobStore.lockHandler.type = Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz
quartz.jobStore.driverDelegateType = Quartz.Impl.AdoJobStore.StdAdoDelegate, Quartz
quartz.dataSource.default.provider = SQLite-10
quartz.jobStore.useProperties = true
I have created the Sqlite database separately and have placed it inside the working directory of my server. When the service initializes however, I get a SchedulerException
that says:
Could not Initialize DataSource: default
With this InnerException
:
Error while reading metadata information for provider 'SQLite-10'
Parameter name: providerName
Do I have to provide my server with Sqlite .DLL
? Because I didn't need to do that for Sql Server.
If you want to use Sqlite with Quartz.net you have to use these keys:
<add key="quartz.threadPool.type" value="Quartz.Simpl.SimpleThreadPool, Quartz" />
<add key="quartz.threadPool.threadCount" value="10" />
<add key="quartz.jobStore.type" value="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz" />
<add key="quartz.jobStore.misfireThreshold" value="60000" />
<add key="quartz.jobStore.lockHandler.type" value="Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz" />
<add key="quartz.jobStore.useProperties" value="true" />
<add key="quartz.jobStore.dataSource" value="default" />
<add key="quartz.jobStore.tablePrefix" value="qrtz_" />
<add key="quartz.jobStore.driverDelegateType" value="Quartz.Impl.AdoJobStore.SQLiteDelegate, Quartz" />
<add key="quartz.dataSource.default.provider" value="SQLite-10" />
<add key="quartz.dataSource.default.connectionString" value="Data Source=postbag-jobs.db;Version=3;" />
I have noticed that your driverDelegateType key is not the right one. You should use SQLiteDelegate:
<add key="quartz.jobStore.driverDelegateType" value="Quartz.Impl.AdoJobStore.SQLiteDelegate, Quartz" />
You need to install the ADO.NET provider as well (nuget):
Install-Package System.Data.SQLite.Core
Another problem you might have is the compatibility with your provider (1.0.94.0) and that one defined in Quartz.Net (1.0.88.0). You can find info here.
To fix this just add this section to your app.config:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Data.SQLite" publicKeyToken="db937bc2d44ff139" culture="neutral" />
<bindingRedirect oldVersion="1.0.88.0" newVersion="1.0.94.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
A working example can be found here on github.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With