Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
NoSQLClient
✓ import { NoSQLClient } from 'oracle-nosqldb';
✗ const NoSQLClient = require('oracle-nosqldb');
The NoSQLClient class is a named export, common in both ESM and CJS environments (using destructuring for CJS).
Region
✓ import { Region } from 'oracle-nosqldb';
✗ import Region from 'oracle-nosqldb';
Region is a named export, not a default export. Incorrectly importing it as a default will fail.
ServiceType
✓ import { ServiceType } from 'oracle-nosqldb';
✗ const ServiceType = require('oracle-nosqldb');
ServiceType is a named export. For CommonJS, ensure proper destructuring like `require('oracle-nosqldb').ServiceType`.
This quickstart demonstrates creating a table, inserting a record using `put()`, retrieving it with `get()`, and finally dropping the table. It provides configuration placeholders for both Oracle NoSQL Database Cloud Service and on-premise/simulator environments.
/*
* A simple example that
* - creates a table
* - inserts a row using the put() operation
* - reads a row using the get() operation
* - drops the table
*
* To run:
* 1. Edit for your target environment and credentials
* 2. Run it:
* node quickstart.js cloud|cloudsim|kvstore
*
* Use 'cloud' for the Oracle NoSQL Database Cloud Service
* Use 'cloudsim' for the Oracle NoSQL Cloud Simulator
* Use 'kvstore' for the Oracle NoSQL Database on-premise
*/
'use strict';
const NoSQLClient = require('oracle-nosqldb').NoSQLClient;
const Region = require('oracle-nosqldb').Region;
const ServiceType = require('oracle-nosqldb').ServiceType;
// --- Configuration (replace with your actual credentials and endpoint) ---
// For Oracle NoSQL Database Cloud Service:
// const config = {
// serviceType: ServiceType.CLOUD,
// region: Region.US_PHOENIX_1, // e.g., Region.US_PHOENIX_1
// auth: {
// userName: process.env.OCI_USER_OCID ?? '',
// tenantId: process.env.OCI_TENANT_OCID ?? '',
// privateKey: process.env.OCI_PRIVATE_KEY_PATH ?? '',
// fingerprint: process.env.OCI_FINGERPRINT ?? '',
// passPhrase: process.env.OCI_PRIVATE_KEY_PASSPHRASE ?? '' // Optional
// }
// };
// For Oracle NoSQL Cloud Simulator or On-Premise:
const config = {
serviceType: ServiceType.KVSTORE,
endpoint: process.env.NOSQL_ENDPOINT ?? 'localhost:8080' // Default for simulator/on-prem
};
async function runQuickstart() {
let client;
try {
client = new NoSQLClient(config);
const tableName = 'quickstartTable';
console.log(`Creating table: ${tableName}`);
await client.tableDDL(`CREATE TABLE ${tableName} (id LONG, name STRING, PRIMARY KEY (id))`);
console.log('Table created.');
const row = { id: 1, name: 'Hello, Oracle NoSQL!' };
console.log(`Putting row: ${JSON.stringify(row)}`);
await client.put(tableName, row);
console.log('Row put.');
console.log(`Getting row with id: ${row.id}`);
const result = await client.get(tableName, { id: row.id });
console.log(`Got row: ${JSON.stringify(result.value)}`);
console.log(`Dropping table: ${tableName}`);
await client.tableDDL(`DROP TABLE ${tableName}`);
console.log('Table dropped.');
} catch (error) {
console.error('Error:', error.message);
} finally {
if (client) {
client.close();
}
}
}
runQuickstart();
Errors
Common errors & fixes
Error: Cannot find module 'oracle-nosqldb'
The `oracle-nosqldb` package has not been installed or is not accessible in the current project's `node_modules`.
fixRun `npm install oracle-nosqldb` in your project directory.
Error: Missing authentication credentials.
When connecting to Oracle NoSQL Database Cloud Service, the `auth` configuration in `NoSQLClient` is incomplete or incorrect, or OCI environment variables are not set.
fixProvide all required OCI credentials (user OCID, tenant OCID, private key, fingerprint) in the `auth` object or ensure they are correctly sourced as environment variables. Check OCI IAM policies for necessary permissions.
Error: connect ECONNREFUSED <address>:<port>
The application failed to connect to the NoSQL Database proxy server, often due to the server not running, being on a different host/port, or firewall issues.
fixVerify that the Oracle NoSQL Database proxy server is running, listening on the specified host and port (e.g., `localhost:8080`), and network firewalls are not blocking the connection.
TypeError: Class constructor NoSQLClient cannot be invoked without 'new'
The `NoSQLClient` class is being called as a function (e.g., `NoSQLClient(config)`) instead of instantiated with the `new` keyword.
fixAlways create an instance of `NoSQLClient` using `const client = new NoSQLClient(config);`.
Audit
Dependencies
No dependency data recorded yet.