JDBC Provider Configuration
Introduction
A JDBC provider allows the Cache Manager to use an SQL database as the datasource lookup for the cache.
The JSLEE comes with following SQL drivers installed by default:
- Postgresql
- Sqlite
Standard drivers implementing JDBC 4.3 or higher will work with the JDBC cache manager.
Configuration
The JDBC cache provider requires the following fields to be configured:
Field | Type | Required? | Default | Description |
---|---|---|---|---|
datasource-name |
String | Yes | - | The name of the database. This is used directly by the JDBC driver. |
lookup-query |
String | Yes | - | The query which is used to populate a cache entry for a given key. |
driver-config |
JSON | Yes | - | The JDBC driver configuration, used to connect to the database. |
Basic configuration may look like:
{
"datasource-name": "number_portability",
"lookup-query": "SELECT destination_realm AS \"Destination-Realm\" FROM ported_numbers WHERE msisdn = ?",
"driver-config": {}
}
Driver Configuration
The configuration for each sql driver remains the same. The following fields must be configured:
Field | Type | Required? | Default | Description |
---|---|---|---|---|
url |
String | Yes | - | JDBC url which the JSLEE can use to connect to the database. |
driverClassName |
String | Yes | - | Class name for the SQL driver to be used. |
user |
String | Yes | - | The username to use to log into the database. |
password |
String | Yes | - | The password to use to log into the database. |
Example of basic configuration for a postgresql driver looks like:
{
"url": "jdbc:postgresql://127.0.0.1/number_portability",
"driverClassName": "org.postgresql",
"user": "nsquared",
"password": "password"
}
Further configuration options for the driver configuration can be found in the Vert.x documentation.