Registry / database / oracle-orm-zn

oracle-orm-zn

JSON →
library1.2.4jsnpmunverified

A minimal ORM for Node.js wrapping the node-oracledb driver. Version 1.2.4 supports table schemas with common data types (INTEGER, FLOAT, STRING, DATE), connection pooling, and CRUD operations (insert, delete, update, findOne, findAll, upsert, etc.). It includes basic aggregation methods (count, max, min, sum) and table management (define, sync, drop). Notable gaps: limited relationship support, no migration system, and sparse documentation. Release cadence appears low; last update likely 2023. Compared to Sequelize or TypeORM, this is a lightweight alternative tightly coupled to Oracle DB.

npm install oracle-orm-zn
INSTALL
IMPORT
SIG · ORACLE-ORM-ZN
O
oracle-orm-zn
databasejavascriptv1.2.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ORM
import { ORM } from 'oracle-orm-zn'
const ORM = require('oracle-orm-zn').ORM
Package ships CommonJS; default export is an object with ORM class. Use destructured named import for clarity.
Model
import { Model } from 'oracle-orm-zn'
const { Model } = require('oracle-orm-zn').default
Model is a named export from the package, not a default export.
DataTypes
import { DataTypes } from 'oracle-orm-zn'
import DataTypes from 'oracle-orm-zn'
DataTypes is a named export providing INTEGER, FLOAT, STRING, DATE constants.

Shows how to initialize ORM with Oracle connection pool, define a model, sync schema, and perform insert/findOne operations.

import { ORM, DataTypes } from 'oracle-orm-zn'; const orm = new ORM(); async function main() { await orm.init({ user: process.env.ORACLE_USER ?? 'hr', password: process.env.ORACLE_PASSWORD ?? 'hr', connectString: process.env.ORACLE_CONNECTION_STRING ?? 'localhost:1521/XEPDB1', poolMin: 2, poolMax: 10 }); const User = orm.define('users', { id: { type: DataTypes.INTEGER, primaryKey: true }, name: { type: DataTypes.STRING, length: 100 }, email: { type: DataTypes.STRING, length: 255 }, created_at: { type: DataTypes.DATE } }); await orm.sync(); // Create tables based on definitions // CRUD example await User.insert({ id: 1, name: 'Alice', email: 'alice@example.com', created_at: new Date() }); const found = await User.findOne({ where: { name: 'Alice' } }); console.log('Found:', found); await orm.pool.close(); // Clean up pool on exit } main().catch(err => console.error(err));
Debug
Known issues
gotchaThe ORM does not automatically manage database schema migrations; sync() may drop and recreate tables. Use with caution in production.
fix
Manually manage schema migrations or avoid sync() on production databases.
affects: >=1.0.0
deprecatedThe package may be underdocumented; error codes (1001-3003) are not exported as constants for programmatic handling.
fix
Check err.errorcode and err.errormsg properties manually.
affects: >=1.0.0
gotchaThe oracledb package must be installed separately (peer dependency) and requires Oracle Instant Client. Missing it causes runtime errors.
fix
Install oracledb per Oracle instructions and ensure Instant Client is available.
affects: >=1.0.0
breakingVersion 1.2.2 added length parameter to column definitions; older versions ignored length. Code relying on defaults may behave unexpectedly.
fix
Explicitly set length in column definitions to ensure consistent behavior across versions.
affects: >=1.2.2
Errors
Common errors & fixes
Error: Pool is not initialized
Calling ORM methods before init() resolves or without valid credentials.
fix
Ensure orm.init() is called and awaited before any database operations.
ORA-12154: TNS:could not resolve the connect identifier specified
Invalid connectString format or Oracle Net service name not configured.
fix
Use a valid Easy Connect string like 'host:port/service_name' or set TNS_ADMIN environment variable.
TypeError: Cannot read properties of undefined (reading 'insert')
Model object not returned properly from orm.define() or incorrect import.
fix
Verify orm.define() returns a Model instance and that you've awaited any async setup.
Error: DPI-1047: Cannot locate a 64-bit Oracle Client library
Oracle Instant Client not installed or not in PATH/LD_LIBRARY_PATH.
fix
Install Oracle Instant Client (basiclite package) and set environment variables per oracledb docs.
Upgrade
Version history
1.2.4latest on npm
Audit
Dependencies
oracledbrequiredCore database driver for Oracle; required runtime dependency.
Agent activity
4 hits · last 30 days
node
4
Resources
oracle-orm-zn — npm install oracle-orm-zn · libregistry