JDBC¶
Forage creates pooled datasources with connection management, optional XA transactions, and auxiliary repositories.
Quick Start¶
forage.myDb.jdbc.db.kind=postgresql
forage.myDb.jdbc.url=jdbc:postgresql://localhost:5432/mydb
forage.myDb.jdbc.username=admin
forage.myDb.jdbc.password=secret
Supported Databases¶
| Name | Description |
|---|---|
postgresql | PostgreSQL database |
db2 | IBM DB2 database |
h2 | H2 database |
hsqldb | HSQLDB database |
mariadb | MariaDB database |
mssql | Microsoft SQL Server database |
mysql | MySQL database |
oracle | Oracle database |
Properties¶
| Property | Description | Type | Default | Required |
|---|---|---|---|---|
forage.jdbc.db.kind | The database kind/type | bean-name | Yes | |
forage.jdbc.url | The JDBC connection URL | string | Yes | |
forage.jdbc.transaction.enabled | Enable transaction management | boolean | false | |
forage.jdbc.aggregation.repository.enabled | Enable aggregation repository (requires transactions to be enabled) | boolean | false | |
forage.jdbc.idempotent.repository.enabled | Enable idempotent repository | boolean | false | |
forage.jdbc.idempotent.repository.table.name | Table name for idempotent repository | string |
Security
| Property | Description | Type | Default | Required |
|---|---|---|---|---|
forage.jdbc.username | The database username | string | Yes | |
forage.jdbc.password | The database password | password | Yes |
Advanced
| Property | Description | Type | Default | Required |
|---|---|---|---|---|
forage.jdbc.pool.initial.size | Initial size of the connection pool | integer | 5 | |
forage.jdbc.pool.min.size | Minimum size of the connection pool | integer | 2 | |
forage.jdbc.pool.max.size | Maximum size of the connection pool | integer | 20 | |
forage.jdbc.pool.acquisition.timeout.seconds | Timeout for acquiring a connection from the pool (seconds) | integer | 5 | |
forage.jdbc.pool.validation.timeout.seconds | Timeout for validating a connection (seconds) | integer | 3 | |
forage.jdbc.pool.leak.timeout.minutes | Timeout for detecting connection leaks (minutes) | integer | 10 | |
forage.jdbc.pool.idle.validation.timeout.minutes | Timeout for validating idle connections (minutes) | integer | 3 | |
forage.jdbc.transaction.timeout.seconds | Timeout for transactions (seconds) | integer | 30 | |
forage.jdbc.transaction.node.id | The transaction node identifier | string | ||
forage.jdbc.transaction.object.store.id | The transaction object store identifier | string | ||
forage.jdbc.transaction.enable.recovery | Enable transaction recovery | boolean | false | |
forage.jdbc.transaction.recovery.modules | Comma-separated list of transaction recovery modules | string | ||
forage.jdbc.transaction.expiry.scanners | Comma-separated list of transaction expiry scanners | string | com.arjuna.ats.internal.arjuna.recovery.ExpiredTransactionStatusManagerScanner | |
forage.jdbc.transaction.xa.resource.orphan.filters | Comma-separated list of XA resource orphan filters | string | ||
forage.jdbc.transaction.object.store.directory | Directory for transaction object store | string | ObjectStore | |
forage.jdbc.transaction.object.store.type | Type of transaction object store (file-system or jdbc) | string | file-system | |
forage.jdbc.transaction.object.store.datasource | DataSource name for JDBC object store | string | ||
forage.jdbc.transaction.object.store.create.table | Create object store table if not exists | boolean | false | |
forage.jdbc.transaction.object.store.drop.table | Drop object store table on shutdown | boolean | false | |
forage.jdbc.transaction.object.store.table.prefix | Prefix for object store tables | string | forage_ | |
forage.jdbc.aggregation.repository.name | Name of the aggregation repository | string | ||
forage.jdbc.aggregation.repository.headers.to.store | Comma-separated list of headers to store | string | ||
forage.jdbc.aggregation.repository.store.body | Store message body in repository | boolean | ||
forage.jdbc.aggregation.repository.dead.letter.uri | Dead letter queue URI for failed aggregations | string | ||
forage.jdbc.aggregation.repository.allow.serialized.headers | Allow serialized headers in repository | boolean | ||
forage.jdbc.aggregation.repository.maximum.redeliveries | Maximum number of redelivery attempts | integer | ||
forage.jdbc.aggregation.repository.use.recovery | Enable recovery for aggregation repository | boolean | ||
forage.jdbc.aggregation.repository.propagation.behaviour.name | Transaction propagation behaviour name | string | ||
forage.jdbc.idempotent.repository.table.create | Create idempotent table if not exists | boolean | true | |
forage.jdbc.idempotent.repository.processor.name | Processor name for idempotent repository | string |
Multiple Datasources¶
Use different names to configure multiple databases: