Skip to main content

Database Setup

For complete installation and configuration instructions, see the Getting Started guide.

Quick Reference​

Supported Databases​

DatabaseStatus
PostgreSQLFull support including domains, enums, arrays, JSON, UUID
MariaDB/MySQLFull support including unsigned types
SQL ServerFull support including T-SQL features
OracleFull support including OBJECT and MULTISET types
DuckDBFull support for embedded analytical workloads
IBM DB2Full support including distinct types
SQLiteFull support for embedded workloads β€” every type affinity, RETURNING, ON CONFLICT upserts
SQLite foreign keys

SQLite parses REFERENCES clauses but doesn't enforce them unless PRAGMA foreign_keys = ON is set on each connection. The SqliteConfig.Builder.foreignKeys(true) helper writes this as a driver property so every pooled connection inherits it β€” turn it on explicitly if you're building a SqliteConfig by hand.

Configuration Example​

sources:
postgres:
type: postgresql
host: localhost
port: 5432
database: myapp
username: ${POSTGRES_USER}
password: ${POSTGRES_PASSWORD}
schemas: [public, sales]

output:
path: ./generated
package: com.myapp.db
language: java

Generate Code​

typr generate

Database-Specific Features​

Each database has unique features that Typr models with full fidelity:

  • PostgreSQL: Arrays, enums, domains, composite types, JSON/JSONB
  • MariaDB: Unsigned integers, ENUMs, SETs
  • Oracle: OBJECT types, nested tables, MULTISET
  • SQL Server: Alias types, table-valued parameters
  • DuckDB: Nested types, structs, lists
  • SQLite: Type-affinity model with aliases (BIGINT/INT8/VARCHAR/CLOB...), ISO-8601 date/time as TEXT, no schemas

See Type Safety for details on how these are represented in generated code.

Next Steps​