Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connecting Quartz to MS Sql Server

I'm fairly new to Quartz Job Scheduler and I may probably be asking stupid questions, but... I'm having trouble with connecting my Quartz.Server.2010 to MS Sql Server 2012.

I have created a couple of jobs which are working perfectly, but cannot create connection with SQL Server.

I have written code in quartz.config file but I keep getting an error I can't resolve:

"The service terminated abnormally, Topshelf.ServiceBuilderException: An exception occurred creating the service: QuartzServer ---> Quartz.SchedulerException: Provider not specified for DataSource: default"

even though I have set the provider in the App.config file:

What could be my problem?

like image 722
Alex123 Avatar asked Mar 20 '23 10:03

Alex123


1 Answers

Short Version:

Do you have this?

 <add key="quartz.dataSource.default.provider" value="SqlServer-20"/>

Longer Version:

The word "default" has no super special meaning. In my .config below, I've used "MySqlServerFullVersion" instead.

But below is a fully functioning Quartz.Impl.AdoJobStore.JobStoreTX

<quartz>

    <add key="quartz.scheduler.instanceName" value="ExampleDefaultQuartzSchedulerFromConfigFileSqlServer"/>
    <add key="quartz.scheduler.instanceId" value="instance_one"/>
    <add key="quartz.threadPool.threadCount" value="10"/>
    <add key="quartz.threadPool.threadPriority" value="Normal"/>

    <!-- 
    org.quartz.scheduler.idleWaitTime
    Is the amount of time in milliseconds that the scheduler will wait before re-queries for available triggers when the scheduler is otherwise idle. Normally you should not have to 'tune' this parameter, unless you're using XA transactions, and are having problems with delayed firings of triggers that should fire immediately.
    It defaults to every 30 seconds until it finds a trigger. Once it finds any triggers, it gets the time of the next trigger to fire and stops checking until then, unless a trigger changes.   -->
    <add key="quartz.scheduler.idleWaitTime" value ="5000"/>

    <!-- Misfire : see http://nurkiewicz.blogspot.com/2012/04/quartz-scheduler-misfire-instructions.html  -->
    <add key="quartz.jobStore.misfireThreshold" value="60000"/>
    <add key="quartz.jobStore.type" value="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz"/>
    <add key="quartz.jobStore.tablePrefix" value="QRTZ_"/>
    <add key="quartz.jobStore.clustered" value="false"/>
    <add key="quartz.jobStore.driverDelegateType" value="Quartz.Impl.AdoJobStore.SqlServerDelegate, Quartz"/>


    <add key="quartz.jobStore.dataSource" value="MySqlServerFullVersion"/>

    <!-- 
    <add key="quartz.jobStore.dataSource" value="MySqlServerCe40"/>
    -->
    <!-- 
    <add key="quartz.jobStore.dataSource" value="MySqlServerCe351"/>
    -->



    <add key="quartz.dataSource.MySqlServerFullVersion.connectionString" value="Server=MyServer\MyInstance;Database=MyQuartzDB;Trusted_Connection=True;Application Name='quartz_config';"/>
    <add key="quartz.dataSource.MySqlServerFullVersion.provider" value="SqlServer-20"/>


    <!-- 
    <add key="quartz.dataSource.MySqlServerCe40.connectionString" value="Data Source=C:\quartznet\quartz2-sqlce4.sdf;Persist Security Info=False;"/>
    <add key="quartz.dataSource.MySqlServerCe40.provider" value="SqlServerCe-400"/>
    -->

    <!-- 
    <add key="quartz.dataSource.MySqlServerCe351.connectionString" value="Data Source=C:\quartznet\quartz2-sqlce35.sdf;Persist Security Info=False;"/>
    <add key="quartz.dataSource.MySqlServerCe351.provider" value="SqlServerCe-351"/>
    -->



</quartz>

PS

You created a DB, correct?

https://github.com/MassTransit/MassTransit-Quartz/blob/master/setup_sql_server.sql

or here:

https://github.com/quartznet/quartznet/blob/master/database/tables/tables_sqlServer.sql

If the above URL(s) (to setup_sql_server.sql) cease to exist, you can internet-search the below text and most likely find the .sql.

ALTER TABLE [dbo].[QRTZ_TRIGGERS] DROP CONSTRAINT FK_QRTZ_TRIGGERS_QRTZ_JOB_DETAILS

like image 164
granadaCoder Avatar answered Apr 27 '23 23:04

granadaCoder