diff --git a/services/base-jdbc/src/main/java/org/eclipse/hono/service/base/jdbc/config/JdbcOptions.java b/services/base-jdbc/src/main/java/org/eclipse/hono/service/base/jdbc/config/JdbcOptions.java
index 6e1fdce0bb..65b72b7dc5 100644
--- a/services/base-jdbc/src/main/java/org/eclipse/hono/service/base/jdbc/config/JdbcOptions.java
+++ b/services/base-jdbc/src/main/java/org/eclipse/hono/service/base/jdbc/config/JdbcOptions.java
@@ -60,6 +60,27 @@ public interface JdbcOptions {
*/
OptionalInt maximumPoolSize();
+ /**
+ * Gets the minimum size of the DB connection pool.
+ *
+ * @return The minimum number of connections in the pool.
+ */
+ OptionalInt minimumPoolSize();
+
+ /**
+ * Gets the initial size of the DB connection pool.
+ *
+ * @return The initial number of connections in the pool.
+ */
+ OptionalInt initialPoolSize();
+
+ /**
+ * Gets the maximum idle time of connections in the DB connection pool.
+ *
+ * @return The maximum idle time of connections in the pool.
+ */
+ OptionalInt maximumIdleTime();
+
/**
* Gets the name of the table that contains the data.
*
diff --git a/services/base-jdbc/src/main/java/org/eclipse/hono/service/base/jdbc/config/JdbcProperties.java b/services/base-jdbc/src/main/java/org/eclipse/hono/service/base/jdbc/config/JdbcProperties.java
index 4f0b067fa5..3ac07bd988 100644
--- a/services/base-jdbc/src/main/java/org/eclipse/hono/service/base/jdbc/config/JdbcProperties.java
+++ b/services/base-jdbc/src/main/java/org/eclipse/hono/service/base/jdbc/config/JdbcProperties.java
@@ -38,6 +38,9 @@ public class JdbcProperties {
private String username;
private String password;
private Integer maximumPoolSize;
+ private Integer minimumPoolSize;
+ private Integer initialPoolSize;
+ private Integer maximumIdleTime;
private String tableName;
/**
@@ -57,6 +60,9 @@ public JdbcProperties(final JdbcOptions options) {
Objects.requireNonNull(options);
setDriverClass(options.driverClass());
options.maximumPoolSize().ifPresent(this::setMaximumPoolSize);
+ options.minimumPoolSize().ifPresent(this::setMinimumPoolSize);
+ options.initialPoolSize().ifPresent(this::setInitialPoolSize);
+ options.maximumIdleTime().ifPresent(this::setMaximumIdleTime);
options.password().ifPresent(this::setPassword);
options.tableName().ifPresent(this::setTableName);
setUrl(options.url());
@@ -98,6 +104,27 @@ public Integer getMaximumPoolSize() {
return maximumPoolSize;
}
+ public void setMinimumPoolSize(final Integer minimumPoolSize) {
+ this.minimumPoolSize = minimumPoolSize;
+ }
+ public Integer getMinimumPoolSize() {
+ return minimumPoolSize;
+ }
+
+ public void setInitialPoolSize(final Integer initialPoolSize) {
+ this.initialPoolSize = initialPoolSize;
+ }
+ public Integer getInitialPoolSize() {
+ return initialPoolSize;
+ }
+
+ public void setMaximumIdleTime(final Integer maximumIdleTime) {
+ this.maximumIdleTime = maximumIdleTime;
+ }
+ public Integer getMaximumIdleTime() {
+ return maximumIdleTime;
+ }
+
public String getTableName() {
return tableName;
}
@@ -126,6 +153,15 @@ public static JDBCClient dataSource(final Vertx vertx, final JdbcProperties data
if (dataSourceProperties.getMaximumPoolSize() != null) {
config.put("max_pool_size", dataSourceProperties.getMaximumPoolSize());
}
+ if (dataSourceProperties.getMinimumPoolSize() != null) {
+ config.put("min_pool_size", dataSourceProperties.getMinimumPoolSize());
+ }
+ if (dataSourceProperties.getInitialPoolSize() != null) {
+ config.put("initial_pool_size", dataSourceProperties.getInitialPoolSize());
+ }
+ if (dataSourceProperties.getMaximumIdleTime() != null) {
+ config.put("max_idle_time", dataSourceProperties.getMaximumIdleTime());
+ }
log.info("Creating new SQL client: {} - table: {}", config, dataSourceProperties.getTableName());
diff --git a/site/documentation/content/admin-guide/jdbc-device-registry-config.md b/site/documentation/content/admin-guide/jdbc-device-registry-config.md
index 507f390f40..83dc57fd4d 100644
--- a/site/documentation/content/admin-guide/jdbc-device-registry-config.md
+++ b/site/documentation/content/admin-guide/jdbc-device-registry-config.md
@@ -66,12 +66,18 @@ and availability.
| `HONO_REGISTRY_JDBC_ADAPTER_USERNAME`
`hono.registry.jdbc.adapter.username` | no | - | The username used to access the database. |
| `HONO_REGISTRY_JDBC_ADAPTER_PASSWORD`
`hono.registry.jdbc.adapter.password` | no | - | The password used to access the database. |
| `HONO_REGISTRY_JDBC_ADAPTER_MAXIMUMPOOLSIZE`
`hono.registry.jdbc.adapter.maximumPoolSize` | no | Depends on the connection pool implementation. `15` for C3P0. | The maximum size of the connection pool. |
+| `HONO_REGISTRY_JDBC_ADAPTER_MINIMUMPOOLSIZE`
`hono.registry.jdbc.adapter.minimumPoolSize` | no | Depends on the connection pool implementation. `3` for C3P0. | The minimum size of the connection pool. |
+| `HONO_REGISTRY_JDBC_ADAPTER_INITIALPOOLSIZE`
`hono.registry.jdbc.adapter.initialPoolSize` | no | Depends on the connection pool implementation. `3` for C3P0. | Number of connections a pool will try to acquire upon startup. Should be between minPoolSize and maxPoolSize. |
+| `HONO_REGISTRY_JDBC_ADAPTER_MAXIMUMIDLETIME`
`hono.registry.jdbc.adapter.maximumIdleTime` | no | Depends on the connection pool implementation. `0` for C3P0. | Seconds a connection can remain pooled but unused before being discarded. Zero means idle connections never expire. |
| `HONO_REGISTRY_JDBC_ADAPTER_TABLENAME`
`hono.registry.jdbc.adapter.tableName` | no | - | The name of the table the datastore uses. If the datastore requires multiple tables, this is the prefix. |
| `HONO_REGISTRY_JDBC_MANAGEMENT_URL`
`hono.registry.jdbc.management.url` | yes | - | The JDBC URL to the database. |
| `HONO_REGISTRY_JDBC_MANAGEMENT_DRIVERCLASS`
`hono.registry.jdbc.management.driverClass` | no | The default driver registered for the JDBC URL. | The class name of the JDBC driver. |
| `HONO_REGISTRY_JDBC_MANAGEMENT_USERNAME`
`hono.registry.jdbc.management.username` | no | - | The username used to access the database. |
| `HONO_REGISTRY_JDBC_MANAGEMENT_PASSWORD`
`hono.registry.jdbc.management.password` | no | - | The password used to access the database. |
| `HONO_REGISTRY_JDBC_MANAGEMENT_MAXIMUMPOOLSIZE`
`hono.registry.jdbc.management.maximumPoolSize` | no | Depends on the connection pool implementation. `15` for C3P0. | The maximum size of the connection pool. |
+| `HONO_REGISTRY_JDBC_MANAGEMENT_MINIMUMPOOLSIZE`
`hono.registry.jdbc.management.minimumPoolSize` | no | Depends on the connection pool implementation. `3` for C3P0. | The minimum size of the connection pool. |
+| `HONO_REGISTRY_JDBC_MANAGEMENT_INITIALPOOLSIZE`
`hono.registry.jdbc.management.initialPoolSize` | no | Depends on the connection pool implementation. `3` for C3P0. | Number of connections a pool will try to acquire upon startup. Should be between minPoolSize and maxPoolSize. |
+| `HONO_REGISTRY_JDBC_MANAGEMENT_MAXIMUMIDLETIME`
`hono.registry.jdbc.management.maximumIdleTime` | no | Depends on the connection pool implementation. `0` for C3P0. | Seconds a connection can remain pooled but unused before being discarded. Zero means idle connections never expire. |
| `HONO_REGISTRY_JDBC_MANAGEMENT_TABLENAME`
`hono.registry.jdbc.management.tableName` | no | - | The name of the table the datastore uses. If the datastore requires multiple tables, this is the prefix. |
| `HONO_REGISTRY_SVC_CREDENTIALSTTL`
`hono.registry.svc.credentialsTtl` | no | `1m` | The TTL for credentials responses. |
| `HONO_REGISTRY_SVC_HASHALGORITHMSWHITELIST`
`hono.registry.svc.hashAlgorithmsWhitelist` | no | `empty` | An array of supported hashing algorithms to be used with the `hashed-password` type of credentials. When not set, all values will be accepted. |
@@ -84,12 +90,18 @@ and availability.
| `HONO_TENANT_JDBC_ADAPTER_USERNAME`
`hono.tenant.jdbc.adapter.username` | no | - | The username used to access the database. |
| `HONO_TENANT_JDBC_ADAPTER_PASSWORD`
`hono.tenant.jdbc.adapter.password` | no | - | The password used to access the database. |
| `HONO_TENANT_JDBC_ADAPTER_MAXIMUMPOOLSIZE`
`hono.tenant.jdbc.adapter.maximumPoolSize` | no | Depends on the connection pool implementation. `15` for C3P0. | The maximum size of the connection pool. |
+| `HONO_TENANT_JDBC_ADAPTER_MINIMUMPOOLSIZE`
`hono.tenant.jdbc.adapter.minimumPoolSize` | no | Depends on the connection pool implementation. `3` for C3P0. | The minimum size of the connection pool. |
+| `HONO_TENANT_JDBC_ADAPTER_INITIALPOOLSIZE`
`hono.tenant.jdbc.adapter.initialPoolSize` | no | Depends on the connection pool implementation. `3` for C3P0. | Number of connections a pool will try to acquire upon startup. Should be between minPoolSize and maxPoolSize. |
+| `HONO_TENANT_JDBC_ADAPTER_MAXIMUMIDLETIME`
`hono.tenant.jdbc.adapter.maximumIdleTime` | no | Depends on the connection pool implementation. `0` for C3P0. | Seconds a connection can remain pooled but unused before being discarded. Zero means idle connections never expire. |
| `HONO_TENANT_JDBC_ADAPTER_TABLENAME`
`hono.tenant.jdbc.adapter.tableName` | no | - | The name of the table the datastore uses. If the datastore requires multiple tables, this is the prefix. |
| `HONO_TENANT_JDBC_MANAGEMENT_URL`
`hono.tenant.jdbc.management.url` | yes | - | The JDBC URL to the database. |
| `HONO_TENANT_JDBC_MANAGEMENT_DRIVERCLASS`
`hono.tenant.jdbc.management.driverClass` | no | The default driver registered for the JDBC URL. | The class name of the JDBC driver. |
| `HONO_TENANT_JDBC_MANAGEMENT_USERNAME`
`hono.tenant.jdbc.management.username` | no | - | The username used to access the database. |
| `HONO_TENANT_JDBC_MANAGEMENT_PASSWORD`
`hono.tenant.jdbc.management.password` | no | - | The password used to access the database. |
| `HONO_TENANT_JDBC_MANAGEMENT_MAXIMUMPOOLSIZE`
`hono.tenant.jdbc.management.maximumPoolSize` | no | Depends on the connection pool implementation. `15` for C3P0. | The maximum size of the connection pool. |
+| `HONO_TENANT_JDBC_MANAGEMENT_MINIMUMPOOLSIZE`
`hono.tenant.jdbc.management.minimumPoolSize` | no | Depends on the connection pool implementation. `3` for C3P0. | The minimum size of the connection pool. |
+| `HONO_TENANT_JDBC_MANAGEMENT_INITIALPOOLSIZE`
`hono.tenant.jdbc.management.initialPoolSize` | no | Depends on the connection pool implementation. `3` for C3P0. | Number of connections a pool will try to acquire upon startup. Should be between minPoolSize and maxPoolSize. |
+| `HONO_TENANT_JDBC_MANAGEMENT_MAXIMUMIDLETIME`
`hono.tenant.jdbc.management.maximumIdleTime` | no | Depends on the connection pool implementation. `0` for C3P0. | Seconds a connection can remain pooled but unused before being discarded. Zero means idle connections never expire. |
| `HONO_TENANT_JDBC_MANAGEMENT_TABLENAME`
`hono.tenant.jdbc.management.tableName` | no | - | The name of the table the datastore uses. If the datastore requires multiple tables, this is the prefix. |
| `HONO_TENANT_SVC_TENANTTTL`
`hono.tenant.service.tenantTtl` | no | `1m` | The TTL for tenant responses. |