Database Setup
For complete installation and configuration instructions, see the Getting Started guide.
Quick Referenceβ
Supported Databasesβ
| Database | Status |
|---|---|
| PostgreSQL | Full support including domains, enums, arrays, JSON, UUID |
| MariaDB/MySQL | Full support including unsigned types |
| SQL Server | Full support including T-SQL features |
| Oracle | Full support including OBJECT and MULTISET types |
| DuckDB | Full support for embedded analytical workloads |
| IBM DB2 | Full support including distinct types |
| SQLite | Full 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β
- Getting Started - Full installation and configuration guide
- Configuration Reference - All configuration options
- Matchers - Control which tables to include
- Customization - Customize generated code