Skip to content

OXY-161: Productionize oxygen-sql JDBC connection params - #306

Merged
Kalin-Rudnicki merged 3 commits into
mainfrom
OXY-161
Aug 15, 2026
Merged

OXY-161: Productionize oxygen-sql JDBC connection params#306
Kalin-Rudnicki merged 3 commits into
mainfrom
OXY-161

Conversation

@Kalin-Rudnicki

Copy link
Copy Markdown
Owner

OXY-161 — Productionize oxygen-sql JDBC params

Today JdbcDriver only ever put user/password into the JDBC Properties, so SSL mode, timeouts, application name, and other connection knobs were inexpressible ("ssl prefer" was impossible without hand-editing the URL). This makes JDBC connection params first-class/typed on DbConfig.

What changed

  • DbConfig.Connection — new optional, typed block:
    • sslMode: Option[SslMode] (Postgres sslmode: disable, allow, prefer, require, verify-ca, verify-full)
    • sslRootCert / sslCert / sslKey (cert/key file paths)
    • connectTimeout / socketTimeout (Duration, sent as whole seconds)
    • applicationName
    • extraProperties: Map[String, String] — escape hatch, copied verbatim
  • Driver / JdbcDrivergetConnection takes the Connection; new testable JdbcDriver.buildProperties assembles the Properties (credentials → typed → extraProperties; extra applied last so the escape hatch wins on collision). GetConnection.layer reads DbConfig.Connection; Database.make/layer thread it through.
  • Defaults preserve current behavior — every field is optional, Connection.default is empty, and connection can be omitted from config JSON entirely.
  • Docsdocs/docs/sql/database.md documents the block + property mapping.

Design notes

  • Property translation is Postgres (pgjdbc) flavored per the ticket analysis; the dialect seam is deferred to OXY-159/160.
  • SslMode uses the exact libpq spellings, decoded case-insensitively.
  • No @jsonSecret on Connection — it carries only paths/timeouts/names (no secret material); sslpassword intentionally left to extraProperties.

Tests

  • New DbConfigSpec (11 tests, unit-level, no live DB): SslMode encode/decode, Connection.properties translation, buildProperties (incl. escape-hatch override), and JSON decoding of Connection + full DbConfig.
  • oxygen-sql / oxygen-sql-test / sql-it compile green; sbt fmt clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_011YxWKdsz97QT9BD7AdpSq6

Comment thread report/OXY-161.md Outdated
Kalin-Rudnicki and others added 3 commits August 15, 2026 11:15
…me, extra props)

Add a typed, optional `DbConfig.Connection` block (SSL mode, cert/key paths,
connect/socket timeouts, application name, and a `Map[String,String]` escape
hatch) and wire it through `Driver`/`JdbcDriver` into the JDBC connection
`Properties` alongside user/password.

- `DbConfig.SslMode` enum encodes/decodes the Postgres `sslmode` spellings
  (disable/allow/prefer/require/verify-ca/verify-full).
- `JdbcDriver.buildProperties` assembles props (credentials -> typed -> extra;
  extra applied last, so the escape hatch wins on collision).
- All fields optional; `Connection.default` is empty and preserves current
  behavior when unset, so `connection` can be omitted from config JSON.
- Unit tests for SslMode encode/decode, Connection.properties, buildProperties,
  and JSON decoding. Docs updated in sql/database.md.

Closes OXY-161.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011YxWKdsz97QT9BD7AdpSq6
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011YxWKdsz97QT9BD7AdpSq6
Per review: the report belongs on the OXY-161 issue, not in-repo.
Moved verbatim to a comment on OXY-161 and deleted the file.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Kalin-Rudnicki
Kalin-Rudnicki merged commit bd40b78 into main Aug 15, 2026
7 checks passed
@Kalin-Rudnicki
Kalin-Rudnicki deleted the OXY-161 branch August 15, 2026 17:22
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