2014-02-26 149 views
1

我是Quartz Job Scheduler的新手,我可能會問一些愚蠢的問題,但是...我將Quartz.Server.2010連接到MS Sql Server 2012時遇到問題。將Quartz連接到MS Sql Server

我創建了一些完美工作的作業,但無法與SQL Server建立連接。

我已經寫代碼quartz.config文件,但我不斷收到一個錯誤,我不能解析:

「服務異常終止,Topshelf.ServiceBuilderException:發生異常創建服務:QuartzServer --- > Quartz.SchedulerException:提供對數據源沒有指定:默認的」

即使我已經設置在App.config文件提供者:

什麼可能是我的問題嗎?

回答

4

短版本:

你有這個嗎?

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

加長版:

的 「默認」 一詞沒有超級特殊的意義。 在我的.config文件中,我使用了「MySqlServerFullVersion」。

但下面是一個全功能的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

您創建了一個數據庫,對不對?

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