Oracle
Use Oracle Database as the JobRunr StorageProvider - driver dependency, configuration, and table creation.
On this page
JobRunr stores all background jobs in Oracle Database through the OracleStorageProvider. JobRunr is tested against the latest gvenzl/oracle-free container.
Add the driver dependency
Add the Oracle JDBC driver to your project. Pick the ojdbc artifact that matches your JDK; the latest versions are on Maven Central.
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc11</artifactId>
<version><!-- latest version --></version>
</dependency>
implementation 'com.oracle.database.jdbc:ojdbc11' // version omitted, use latest
Configuration
If you use a framework starter, JobRunr automatically detects your existing DataSource - configure your database the usual way and you are done.
HikariConfig config = new HikariConfig();
config.setJdbcUrl("jdbc:oracle:thin:@localhost:1521/XEPDB1");
config.setUsername("myuser");
config.setPassword("mypassword");
DataSource dataSource = new HikariDataSource(config);
JobRunr.configure()
.useStorageProvider(SqlStorageProviderFactory.using(dataSource))
.useBackgroundJobServer()
.initialize();
datasources:
default:
url: jdbc:oracle:thin:@localhost:1521/XEPDB1
username: myuser
password: mypassword
driver-class-name: oracle.jdbc.OracleDriver
quarkus.datasource.db-kind=oracle
quarkus.datasource.jdbc.url=jdbc:oracle:thin:@localhost:1521/XEPDB1
quarkus.datasource.username=myuser
quarkus.datasource.password=mypassword
spring.datasource.url=jdbc:oracle:thin:@localhost:1521/XEPDB1
spring.datasource.username=myuser
spring.datasource.password=mypassword
Creating the tables
By default JobRunr creates its tables automatically. If you want to create them yourself, use the DatabaseCreator or generate the SQL scripts with migration type oracle. See Setting up an SQL database.
Next steps
- Keep the tables in their own schema: JobRunr can prefix every table it creates. See table prefix and schema.
- Using more than one database? Tell JobRunr which one it should use. See multiple databases in one application.
- Build the
StorageProvideryourself: Useful for an explicit table prefix,DatabaseOptions, or a provider JobRunr does not pick up automatically. See configuring the StorageProvider yourself.
Looking for another database? Back to the Storage overview.
