Skip to content

feat(ext): add Oracle and SQL Server database support #445

Description

@timveil

Roadmap item: Additional database support (Oracle, SQL Server).

Background

Database support is an SPI: DatabaseSupport (interface) + AbstractDatabaseSupport (a Map<JDBCType, GeneratorFactory> registry seeded by registerDefaults(), customized via the configure(Map) hook). Selection is DatabaseSupport.forProduct(productName) — a case-insensitive substring match that today knows cockroach, mysql, postgres, else DefaultSupport. The library itself is driver-agnostic (JDBC drivers are test-scoped only).

Adding a database = a new *Support subclass with a configure() override + a forProduct branch + integration coverage. The recent PostgreSQL/MySQL work (#444) is the template, including the empirical discovery step (dump DATA_TYPE/TYPE_NAME per column from the real driver before coding the dispatch).

Scope

OracleSupport

The hard part is Oracle's type model:

  • NUMBER is the single numeric type — map by precision/scale (scale 0 → integer-family, else BigDecimal). maxDigits/maxSize from metadata drive this.
  • VARCHAR2, NVARCHAR2, CHAR, NCHAR → string generators
  • CLOB, NCLOB, BLOB, RAW/LONG RAW
  • DATE (Oracle DATE includes time-of-day), TIMESTAMP, TIMESTAMP WITH [LOCAL] TIME ZONE
  • BINARY_FLOAT, BINARY_DOUBLE
  • INTERVAL YEAR TO MONTH, INTERVAL DAY TO SECOND
  • No native BOOLEAN before Oracle 23c (23c adds it) — decide target version
  • ojdbc surfaces several types via oracle.jdbc.OracleTypes; confirm empirically

Driver: com.oracle.database.jdbc:ojdbc11 (test). Container: org.testcontainers:oracle-free (gvenzl/oracle-free image).

SQLServerSupport

  • UNIQUEIDENTIFIER (GUID string — reuse/extend UUIDGenerator)
  • BIT → boolean; TINYINT is unsigned 0–255 (matches the existing default generator)
  • DATETIME, DATETIME2, SMALLDATETIME, DATETIMEOFFSET, DATE, TIME
  • MONEY, SMALLMONEY
  • NVARCHAR, NCHAR, NTEXT, VARBINARY, IMAGE
  • XML (reuse XmlGenerator)
  • CLR types HIERARCHYID, GEOGRAPHY, GEOMETRY → out of scope; should throw UnsupportedOperationException (consistent with how unsupported PG/MySQL types behave today)

Driver: com.microsoft.sqlserver:mssql-jdbc (test). Container: org.testcontainers:mssqlserver (requires acceptLicense()).

Shared

  • DatabaseSupport.forProduct: add oracle and microsoft sql server/sqlserver branches + cases in DatabaseSupportSelectionTest.
  • create_tables.{oracle,sqlserver}.sql comprehensive type schemas + fillTestTables integration tests (mirror PostgresFillerTest/MySqlFillerTest).
  • Unit coverage in DatabaseSupportTest for the new dispatch.

Acceptance criteria

  • OracleSupport + SQLServerSupport registered and selectable via forProduct
  • Comprehensive type schemas fill cleanly on real containers (latest GA server versions)
  • Unsupported vendor types throw UnsupportedOperationException rather than generating invalid data
  • README "Database Support" table updated

Notes

Worth splitting into two PRs (one per database) — each needs its own driver, container, and EULA/image considerations. Oracle NUMBER mapping is the main design risk; do the empirical discovery dump first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestjavaPull requests that update java code

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions