@samveys/oracle

Version
1.0.3Nov 5, 2026
Install
pnpm add @samveys/oracle

From packages/oracle/README.md in the framework repository.

Oracle Database driver for @samveys/database. It uses oracledb in thin mode (pure JavaScript, no Instant Client), imported on first connect. The workspace sets allowBuilds: oracledb: false, because thin mode needs no install script.

ts
import { createDatabaseManager, defineDatabaseConfig } from '@samveys/database'
import { oracle } from '@samveys/oracle'

const db = createDatabaseManager(
  defineDatabaseConfig({
    default: 'main',
    connections: { main: oracle({ host: '127.0.0.1', serviceName: 'FREEPDB1', user: 'app', password: process.env.ORACLE_PASSWORD ?? '' }) },
  }),
)
const rows = await db.from('users').where('id', 1).get()
console.log(rows.length)
await db.close()

Dialect

  • Identifiers are quoted in upper case ("USERS"), the name Oracle gives an unquoted identifier, so raw SQL and builder SQL refer to the same table. Upper-case result labels are folded back to lower case (id, name).
  • Bindings are :1, :2, …. Pagination is offset :n rows fetch next :m rows only (12c+). Derived tables take no as.
  • No RETURNING: after an insert the driver reads the generated id back by ROWID and returns it as insertId.
  • Values: number(1) ↔ boolean, integer number ↔ number | bigint (every digit kept), date ↔ Temporal.PlainDate, timestamp ↔ Temporal.PlainDateTime, timestamp with time zone ↔ Temporal.Instant. Microseconds are kept: the driver reads the exact wire components, because thin mode's own Date keeps milliseconds only.
  • Sessions run in UTC with ISO NLS formats. Savepoints are savepoint / rollback to savepoint. DDL commits implicitly (transactionalDdl: false).
  • Cancellation calls connection.break() and rejects at once with the abort reason. The connection goes back to the pool only after the interrupted call has ended.
  • Errors are SVS_E071 with the ORA- code in meta.engineCode (ORA-00001 unique, ORA-02291 foreign key, ORA-01400 not null).

Differences

  • Oracle stores '' and zero-length binary values as NULL. The conformance case for empty binary is limited to the other engines for that reason.

Conformance

SVS_REQUIRE_DOCKER=1 node --no-warnings --test packages/oracle/test/conformance.test.ts starts gvenzl/oracle-free:23-slim (native arm64 and x64), runs the conformance cases, and removes the container. The migrations area is skipped: the schema builder has no Oracle catalog queries yet (ADR 0014).