Skip to main content
The SQL backend stores all SMP data in a relational database. It is appropriate for production deployments that require high concurrency, operational tooling, or integration with existing database infrastructure.

Supported databases

Databasetarget-database valueJDBC driver class
MySQL 5.7+ / 8.xMySQLcom.mysql.cj.jdbc.Driver
PostgreSQL 12+PostgreSQLorg.postgresql.Driver
Oracle 12c+Oracleoracle.jdbc.driver.OracleDriver
IBM DB2DB2com.ibm.db2.jcc.DB2Driver
Microsoft SQL ServerSQLServercom.microsoft.sqlserver.jdbc.SQLServerDriver

Selecting the SQL backend

Set the following property in application.properties:
smp.backend = sql
Use the phoss-smp-webapp-sql WAR when deploying.

Required configuration

All jdbc.* and target-database properties must be set for the backend to start.
jdbc.driver   = com.mysql.cj.jdbc.Driver
jdbc.url      = jdbc:mysql://localhost:3306/smp?useUnicode=true&serverTimezone=UTC&autoReconnect=true
jdbc.user     = smp
jdbc.password = smp
jdbc.schema   = smp
target-database = MySQL

Full property reference

PropertyRequiredDescription
jdbc.driverYesFully-qualified JDBC driver class name
jdbc.urlYesJDBC connection URL
jdbc.userYesDatabase username
jdbc.passwordYesDatabase password
jdbc.schemaNoSchema name. When set, Flyway targets this schema
jdbc.schema-createNoCreate the schema automatically if it does not exist (default: false)
target-databaseYesDatabase dialect: MySQL, PostgreSQL, Oracle, DB2, SQLServer
jdbc.execution-time-warning.enabledNoLog a warning when a query exceeds the threshold (default: true)
jdbc.execution-time-warning.msNoThreshold in milliseconds (default: 5000)
jdbc.cache.sg.enabledNoIn-memory cache for service groups (default: true)

Database-specific examples

jdbc.driver     = com.mysql.cj.jdbc.Driver
jdbc.url        = jdbc:mysql://localhost:3306/smp?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC&autoReconnect=true
jdbc.user       = smp
jdbc.password   = smp
jdbc.schema     = smp
target-database = MySQL
Add the MySQL Connector/J dependency to your WAR or make it available on the application-server classpath:
<dependency>
  <groupId>com.mysql</groupId>
  <artifactId>mysql-connector-j</artifactId>
  <version>8.x.x</version>
</dependency>

Connection pooling (DBCP2)

phoss SMP uses Apache Commons DBCP2 for connection pooling. The following properties are available since v8.0.11:
PropertyDefaultDescription
jdbc.pooling.max-connections8Maximum number of active connections that can be allocated from the pool at the same time. Negative value means no limit.
jdbc.pooling.max-wait.millis10000Maximum milliseconds to wait for an available connection before throwing an exception. -1 waits indefinitely.
jdbc.pooling.between-evictions-runs.millis300000Milliseconds between idle-connection eviction runs (5 minutes). Non-positive disables the evictor.
jdbc.pooling.min-evictable-idle.millis1800000Minimum milliseconds a connection may sit idle before becoming eligible for eviction (30 minutes).
jdbc.pooling.remove-abandoned-timeout.millis300000Milliseconds before an abandoned connection can be removed (5 minutes).
jdbc.pooling.test-on-borrowfalseValidate connections before lending them from the pool (since v8.0.12).
# Example: increase pool size and borrow timeout for a busy deployment
jdbc.pooling.max-connections              = 20
jdbc.pooling.max-wait.millis             = 30000
jdbc.pooling.between-evictions-runs.millis = 300000
jdbc.pooling.min-evictable-idle.millis   = 1800000
jdbc.pooling.test-on-borrow              = true
Set jdbc.pooling.test-on-borrow = true in environments where connections may be silently dropped by a firewall or load balancer between eviction runs.

Schema migration with Flyway

The SQL backend uses Flyway to manage database schema versions. Flyway applies versioned migration scripts automatically on startup, so the schema is always in sync with the running code. Migration scripts live under db/migrate-{dialect}/ inside the phoss-smp-backend-sql JAR:
db/
├── migrate-mysql/
├── migrate-postgresql/
├── migrate-oracle/
├── migrate-db2/
└── migrate-sqlserver/
Flyway configuration properties:
PropertyDefaultDescription
smp.flyway.enabledtrueEnable or disable automatic schema migration
smp.flyway.baseline.version0Flyway baseline version for existing databases
smp.flyway.jdbc.url(same as jdbc.url)Override JDBC URL for Flyway only (e.g., use a privileged account for DDL)
smp.flyway.jdbc.user(same as jdbc.user)Override database user for Flyway migrations
smp.flyway.jdbc.password(same as jdbc.password)Override database password for Flyway migrations
If your DBA policy requires schema changes to run under a privileged account separate from the application account, set smp.flyway.jdbc.user, smp.flyway.jdbc.password, and smp.flyway.jdbc.url to the privileged credentials. The runtime connection pool will still use the regular jdbc.* credentials.

Initial database setup

The database (schema) must exist before phoss SMP starts. Flyway will create tables and seed data automatically, but it will not create the database itself.
1

Create the database

Create an empty database and a dedicated user:
-- MySQL example
CREATE DATABASE smp CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'smp'@'%' IDENTIFIED BY 'smp';
GRANT ALL PRIVILEGES ON smp.* TO 'smp'@'%';
FLUSH PRIVILEGES;
2

Configure application.properties

Set the jdbc.* and target-database properties as shown in the examples above.
3

Start phoss SMP

On first startup, Flyway detects that the schema is empty and applies all migration scripts in order, creating all required tables.

Debugging

Enable additional SQL-level logging to troubleshoot connection or query issues:
jdbc.debug.connections   = false
jdbc.debug.transactions  = false
jdbc.debug.sql           = true   # Logs every SQL statement
Do not enable jdbc.debug.sql in production — it logs every SQL statement and can produce very large log files.

SQL status endpoint

The SQL backend exposes connection pool statistics via the /smp-status/ endpoint when both smp.status.enabled = true and smp.status.sql.enabled = true are set (the SQL status is enabled by default):
smp.status.enabled     = true
smp.status.sql.enabled = true

Build docs developers (and LLMs) love