title: Retry Quartz Scheduler start up on database connection failure
body: <p>We have a Java application that uses Quartz for scheduling jobs. The version of quartz that we use is: quartz-2.2.1</p>
  
  <p>The quartz configuration uses JDBC job store.</p>
  
  <p>If the database connection is down (due to intermittent network failure) at the time of calling start method on quartz scheduler object, it fails with the following exception:</p>
  
  <pre><code>2017-05-28 00:05:45 org.quartz.SchedulerConfigException: Failure occured during job recovery. [See nested exception: org.quartz.JobPersistenceException: Couldn't recover jobs: The connection is closed. [See nested exception: com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed.]]
  2017-05-28 00:05:45     at org.quartz.impl.jdbcjobstore.JobStoreSupport.schedulerStarted(JobStoreSupport.java:692)
  2017-05-28 00:05:45     at org.quartz.core.QuartzScheduler.start(QuartzScheduler.java:567)
  2017-05-28 00:05:45     at org.quartz.impl.StdScheduler.start(StdScheduler.java:142)
  </code></pre>
  
  <p>In order to ensure that quartz scheduler is started successfully, we added retry in our code which makes a call to start method on quartz scheduler object after every 1 second. But when the database connection is up, the call to quartz scheduler start method is successful (it doesn't throw any exception) - but the associated triggers that reside in the database are not started and no job is triggered.</p>
  
  <p>Any idea what could be the issue here? Any help shall be appreciated.</p>
  
  <p>Here is the quartz configuration, please note that we have already enabled validation query to handle crappy connections (due to intermittent network failure)</p>
  
  <pre><code>#============================================================================
  # Configure Main Scheduler Properties  
  #============================================================================
  
  org.quartz.scheduler.instanceName = TestScheduler
  org.quartz.scheduler.instanceId = AUTO
  org.quartz.scheduler.skipUpdateCheck=true
  
  #============================================================================
  # Configure ThreadPool  
  #============================================================================
  
  org.quartz.threadPool.class =     org.quartz.simpl.SimpleThreadPool
  org.quartz.threadPool.threadCount =  50
  org.quartz.threadPool.threadPriority = 5
  
  #============================================================================
  # Configure JobStore  
  #============================================================================
  
  org.quartz.jobStore.misfireThreshold = 60000
  org.quartz.jobStore.maxMisfiresToHandleAtATime = 15
  
  org.quartz.jobStore.class =     org.quartz.impl.jdbcjobstore.JobStoreTX
  org.quartz.jobStore.driverDelegateClass =     org.quartz.impl.jdbcjobstore.StdJDBCDelegate
  org.quartz.jobStore.useProperties = false
  org.quartz.jobStore.dataSource = aBPM
  org.quartz.jobStore.tablePrefix = ABPM_
  org.quartz.jobStore.isClustered = false
  org.quartz.jobStore.useDBLocks = false
  org.quartz.jobStore.acquireTriggersWithinLock = true
  
  #============================================================================
  # Configure Datasources  
  #============================================================================
  org.quartz.dataSource.aBPM.driver = org.hsqldb.jdbcDriver
  org.quartz.dataSource.aBPM.URL = jdbc:hsqldb:file:embeddedDb/db/abpmquartz
  org.quartz.dataSource.aBPM.user = sa
  org.quartz.dataSource.aBPM.encryptPassword = yes
  org.quartz.dataSource.aBPM.password = fMFVvEFk3gFmM9ewWQkTNg==
  org.quartz.dataSource.aBPM.maxConnections = 55
  org.quartz.dataSource.aBPM.validationQuery= SELECT 1
  </code></pre>