By default, the Runtime Scheduler is using the H2 internal database to store Schedules.
Here is how to configure the Scheduler to use another database.
Prepare the database
These steps may vary depending on the database type (MS Sql Server, Oracle, Postgresql, DB2...), but generally speaking you need to:
- Create a schema - or decide to use an existing schema
- Create the Scheduler tables, using the sample SQL scripts in stambiaRuntime\scripts\scheduler
Make sure that all the tables were created:
stb_blob_triggers
stb_calendars
stb_cron_triggers
stb_fired_triggers
stb_job_details
stb_job_listeners
stb_locks
stb_paused_trigger_grps
stb_scheduler_state
stb_simple_triggers
stb_trigger_listeners
stb_triggers
Install the JDBC driver in the Runtime
Download the JDBC driver for your database from the vendor's website.
- Runtime S19 or older: copy the .jar file into lib/jdbc
- Runtime S20 and higher: copy the .jar file into modules/default
Configure the scheduler in engineScheduler.properties
- Copy the sample engineScheduler.properties file to stambiaRuntime\properties
- If using a single Runtime: from stambiaRuntime\properties\samples\scheduler\common
- If using a Runtime cluster: from stambiaRuntime\properties\samples\scheduler\example-cluster-with-variables
- Set the org.quartz.jobStore.dataSource to a logical name of your choice
- Set the org.quartz.dataSource.<datasourceName>.* properties
Here is a working example for Mysql 8.
Note:
- The schema name is set in the JDBC URL
- The datasource name "mysqldatabase" must match the org.quartz.dataSource.<datasourceName>.* properties
org.quartz.jobStore.dataSource = mysqldatabase
org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate
[...]
org.quartz.dataSource.mysqldatabase.driver = com.mysql.cj.jdbc.Driver
org.quartz.dataSource.mysqldatabase.URL = jdbc:mysql://localhost:3306/stbscheduler?serverTimezone=Europe/Paris
org.quartz.dataSource.mysqldatabase.user = user01
org.quartz.dataSource.mysqldatabase.password = ...
org.quartz.dataSource.mysqldatabase.maxConnections = 5
org.quartz.dataSource.mysqldatabase.validationQuery = SELECT 1