Configuration Reference

Configure DataSources

If you’re using JDBC-Jobstore, you’ll be needing a DataSource for its use (or two DataSources, if you’re using JobStoreCMT).

DataSources can be configured in three ways:

  1. All pool properties specified in the file, so that Quartz can create the DataSource itself.
  2. The JNDI location of an application server managed Datasource can be specified, so that Quartz can use it.
  3. Custom defined org.quartz.utils.ConnectionProvider implementations.

It is recommended that your Datasource max connection size be configured to be at least the number of worker threads in the thread pool plus three. You may need additional connections if your application is also making frequent calls to the scheduler API. If you are using JobStoreCMT, the “non managed” datasource should have a max connection size of at least four.

Each DataSource you define (typically one or two) must be given a name, and the properties you define for each must contain that name, as shown below. The DataSource’s “NAME” can be anything you want, and has no meaning other than being able to identify it when it is assigned to the JDBCJobStore.

Quartz-created DataSources are defined with the following properties:

Property Name Required Type Default Value
org.quartz.dataSource.NAME.driver yes String null
org.quartz.dataSource.NAME.URL yes String null
org.quartz.dataSource.NAME.user no String ""
org.quartz.dataSource.NAME.password no String ""
org.quartz.dataSource.NAME.maxConnections no int 10
org.quartz.dataSource.NAME.validationQuery no String null
org.quartz.dataSource.NAME.idleConnectionValidationSeconds no int 50
org.quartz.dataSource.NAME.validateOnCheckout no boolean false
org.quartz.dataSource.NAME.discardIdleConnectionsSeconds no int 0 (disabled)


Must be the java class name of the JDBC driver for your database.


The connection URL (host, port, etc.) for connection to your database.


The user name to use when connecting to your database.


The password to use when connecting to your database.


The maximum number of connections that the DataSource can create in it’s pool of connections.


Is an optional SQL query string that the DataSource can use to detect and replace failed/corrupt connections.
For example an oracle user might choose “select table_name from user_tables” - which is a query that should never fail - unless the connection is actually bad.


The number of seconds between tests of idle connections - only enabled if the validation query property is set.
Default is 50 seconds.


Whether the database sql query to validate connections should be executed every time a connection is retrieved from the pool to ensure that it is still valid. If false, then validation will occur on check-in. Default is false.


Discard connections after they have been idle this many seconds. 0 disables the feature. Default is 0.

Example of a Quartz-defined DataSource

org.quartz.dataSource.myDS.driver = oracle.jdbc.driver.OracleDriver
org.quartz.dataSource.myDS.URL = jdbc:oracle:thin:@
org.quartz.dataSource.myDS.user = myUser
org.quartz.dataSource.myDS.password = myPassword
org.quartz.dataSource.myDS.maxConnections = 30

References to Application Server DataSources are defined with the following properties:

Property Name Required Type Default Value
org.quartz.dataSource.NAME.jndiURL yes String null no String null no String null no String null no String null


The JNDI URL for a DataSource that is managed by your application server.

The (optional) class name of the JNDI InitialContextFactory that you wish to use.

The (optional) URL for connecting to the JNDI context.

The (optional) user principal for connecting to the JNDI context.

The (optional) user credentials for connecting to the JNDI context.

Example of a Datasource referenced from an Application Server


Custom ConnectionProvider Implementations

Property Name Required Type Default Value
org.quartz.dataSource.NAME.connectionProvider.class yes String (class name) null


The class name of the ConnectionProvider to use. After instantiating the class, Quartz can automatically set configuration properties on the instance, bean-style.

Example of Using a Custom ConnectionProvider Implementation

org.quartz.dataSource.myCustomDS.connectionProvider.class =
org.quartz.dataSource.myCustomDS.someStringProperty = someValue
org.quartz.dataSource.myCustomDS.someIntProperty = 5