Skip to content

feat: boot-db-jdbc-postgresql and boot-db-jdbc-mysql driver modules - #38

Merged
rocketraman merged 1 commit into
masterfrom
claude/boot-db-jdbc-modules-af10fa
Oct 19, 2026
Merged

rocketraman merged 1 commit into
masterfrom
claude/boot-db-jdbc-modules-af10fa

Conversation

@rocketraman

Copy link
Copy Markdown
Owner

What

Two new driver modules, alongside boot-db-jdbc-sqlite:

  • boot-db-jdbc-postgresql: PostgresqlConfig (host, port, database, credentials, plus typed currentSchema, applicationName, sslMode, connectTimeout, socketTimeout, reWriteBatchedInserts), postgresqlConfigModule (Kodein), PostgresqlConfigBindings (Metro).
  • boot-db-jdbc-mysql: MysqlConfig (host, port, database, credentials, plus typed sslMode, allowPublicKeyRetrieval, connectTimeout, socketTimeout, rewriteBatchedStatements, prepared statement cache), mysqlConfigModule (Kodein), MysqlConfigBindings (Metro).

Both decode from db.jdbc, like the SQLite module.

Design notes

  • Typed settings go to the driver as connection properties. Settings left null keep the driver's default, and there's no free-form properties map. For addresses this can't express (e.g. multi-host failover), the KDoc points to JdbcGenericConfig.
  • MySQL's one opinionated default: Connector/J's prepared statement cache is on (cachePrepStmts, 250 statements, 2048-char limit), as HikariCP recommends. PostgreSQL keeps every driver default.
  • IPv6 hosts are bracketed in the URL.
  • toString masks the password, like JdbcGenericConfig.
  • Dependencies: the JDBC driver is api (pgjdbc 42.7.14, mysql-connector-j 26.7.0). The Flyway database module (flyway-database-postgresql / flyway-mysql) is runtimeOnly, so boot-db-flyway works without the application adding it.

Tests

  • Config unit tests: URL, connection properties, password masking.
  • Wiring tests: Hoplite (including strict mode alongside db.pool), Kodein, and Metro. They build the pool without connecting.
  • Database tests against real postgres:18-alpine and mysql:8.4 containers, via Testcontainers 2.0.5. They check that connection settings reach the server and that a Flyway migration runs, which needs the runtimeOnly Flyway module.
    • Skipped where Docker is unavailable, except when CI is set, so they always run on GitHub Actions.
    • AGENTS.md notes how to run them with rootless Podman.

./gradlew build passes locally, with the container tests running under Podman.

Typed JdbcConfig implementations for PostgreSQL (PostgresqlConfig) and
MySQL (MysqlConfig), decoded from db.jdbc, with Kodein and Metro
bindings like boot-db-jdbc-sqlite. Each takes host, port, database
and credentials, and passes typed driver settings (sslMode, timeouts,
and so on) as connection properties. MysqlConfig turns on
Connector/J's prepared statement cache, as HikariCP recommends.

Each module brings its JDBC driver as api, and its Flyway database
module as runtimeOnly, so boot-db-flyway works with it.

Tests run against real servers with Testcontainers; they are skipped
where Docker is unavailable, except on CI.
@rocketraman
rocketraman force-pushed the claude/boot-db-jdbc-modules-af10fa branch from f63240a to dc5818d Compare October 19, 2026 18:22
@rocketraman
rocketraman merged commit 65c5d39 into master Oct 19, 2026
2 checks passed
@rocketraman
rocketraman deleted the claude/boot-db-jdbc-modules-af10fa branch October 19, 2026 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant