将 Quartz 连接到 MS Sql Server [英] Connecting Quartz to MS Sql Server

查看:79
本文介绍了将 Quartz 连接到 MS Sql Server的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 Quartz Job Scheduler 还很陌生,我可能会问一些愚蠢的问题,但是……我在将 Quartz.Server.2010 连接到 MS Sql Server 2012 时遇到了问题.

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.

我创建了几个工作正常的作业,但无法创建与 SQL Server 的连接.

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

我已经在quartz.config 文件中编写了代码,但我不断收到一个我无法解决的错误:

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

服务异常终止,Topshelf.ServiceBuilderException:创建服务时发生异常:QuartzServer ---> Quartz.SchedulerException:未为数据源指定提供者:默认"

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

即使我在 App.config 文件中设置了提供程序:

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

我的问题是什么?

推荐答案

简短版本:

你有吗?

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

更长的版本:

默认"这个词没有特别的意义.在下面的 .config 中,我改用了MySqlServerFullVersion".

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

但下面是一个功能齐全的 Quartz.Impl.AdoJobStore.JobStoreTX

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>

附注

你创建了一个数据库,对吗?

You created a DB, correct?

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

或在这里:

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

如果上述 URL(到 setup_sql_server.sql)不存在,您可以在互联网上搜索以下文本,很可能会找到 .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 CONSTRAINTFK_QRTZ_TRIGGERS_QRTZ_JOB_DETAILS

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

这篇关于将 Quartz 连接到 MS Sql Server的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆