Repository navigation
v1.0.0
First release: a Java 17 JDBC driver and PostgreSQL SQL runtime that absorb the Oracle SQL and JDBC differences Java applications rely on.
Orafit lets an existing Oracle-oriented Java application run on PostgreSQL through pgJDBC. It does not migrate tables or data; use a tool such as Ora2Pg for that. It is not a full Oracle emulator: SQL whose Oracle behavior cannot be reproduced reliably is rejected instead of approximated.
Features
- JDBC driver:
jdbc:orafit:URL andio.github.orafit.jdbc.OrafitDriver, delegating to pgJDBC. Bind parameters, OUT values, JDBC result metadata, update counts, vendor error codes, and transaction state are preserved. - SQL rewriting within the verified scope:
DUAL, empty-string/NULL semantics,ROWNUM, legacy outer joins(+),LISTAGG, hierarchical queries,MERGE,RETURNING INTO. - SQL runtime: a native extension for self-managed PostgreSQL and a plain SQL installer for managed services such as Aurora PostgreSQL.
- Offline analyzer: included in the JAR; scans SQL files without executing them and summarizes what is rewritten, rejected, or out of scope.
Verified coverage (representative cases):
- Numeric:
MOD,REMAINDER,SQRT,CEIL,TO_NUMBER; NUMBER division precision, rounding and overflow. - String:
REPLACE,TRANSLATE,TO_CHAR,UPPER,RPAD,LENGTH;CHARblank-padding comparison; mixed-typeNULLIF/COALESCEdatatype errors. - Date: DATE subtraction, TIMESTAMP to DATE truncation,
TO_DATEerror precedence,NEXT_DAY,TRUNC/ROUND,EXTRACT. - Query: fractional, NULL and negative
FETCHcounts;NEXTVALrepeated in one row;NEXTVALinWHERErejected as ORA-02287.
Scope and limitations
Each area in COMPATIBILITY.md is one of ✅ Supported, STDDEV precision, FETCH PERCENT, mixed TIMESTAMP/DATE subtraction, BYTE/Unicode/character-set-dependent functions, IGNORE NULLS, MEDIAN, PERCENTILE_CONT, KEEP (DENSE_RANK ...), RAW conversion, NLS-dependent conversion.
| Item | Target |
|---|---|
| Java | 17 or later |
| Oracle baseline | Oracle Database 18c XE |
| PostgreSQL | 16 supported, 17 primary, 18 compatibility check only; 15 and older not supported |
| Aurora PostgreSQL 16/17 | Supported through the plain SQL installer |
Verification
501 differential tests between Oracle 18c XE 18.4.0.0.0 and embedded PostgreSQL 17.10, and 672 Maven tests, all passing. Within the declared scope they compare values, row order, NULLs, errors, binds/OUT values, JDBC metadata, update counts, and post-DML state.
Downloads
orafit-jdbc-1.0.0.jar— JDBC driver and offline analyzer. pgJDBC is not bundled; provide it in your application.orafit-jdbc-1.0.0-runtime.tar.gz— SQL runtime:native/for self-managed PostgreSQL,plain/for managed services.SHA256SUMS— SHA-256 checksums for the two files above.
Also on Maven Central: io.github.ltslab:orafit-jdbc:1.0.0
Install / Upgrade
- Extract the runtime archive. Self-managed PostgreSQL: copy
native/to the extension directory and runCREATE EXTENSION orafit;. Managed PostgreSQL: runpsql -v ON_ERROR_STOP=1 -f orafit--1.0.0.sqlfromplain/. - Add
orafit-jdbc-1.0.0.jarand pgJDBC to the classpath. - Set
driver=io.github.orafit.jdbc.OrafitDriverandurl=jdbc:orafit://<host>:<port>/<database>.
Analyzer: java -jar orafit-jdbc-1.0.0.jar [--details] path/to/sql. License: MIT; the bundled JSqlParser is Apache-2.0 (see THIRD_PARTY_NOTICES.md).
Full Changelog: https://github.com/ltslab/orafit/commits/v1.0.0