Registry / database / dmdb
library1.0.48286jsnpmunverified

DMDB is a native Node.js driver for the Dameng 8 (DM8) relational database, providing direct database connectivity and interaction. The current stable version is 1.0.48286 (as of March 2026), with a frequent release cadence, often monthly or bi-monthly, addressing bugs, performance, and new features. Key differentiators include its tight integration with the DM8 ecosystem, official support for Node.js versions 12 and above, and extensions for popular ORMs like TypeORM and Knex via `typeorm-dm` and `knex-dm` packages. The driver supports features like connection pooling, statement caching, and optional Snappy compression for internal communication. It also aims for compatibility with OracleDB-like API patterns, which is a significant aspect for developers migrating or working with similar database drivers.

npm install dmdb
INSTALL
IMPORT
SIG · DMDB
D
dmdb
databasejavascriptv1.0.48286
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
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
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

dmdb
import dmdb from 'dmdb';
const dmdb = require('dmdb');
The primary way to import the main driver object containing functions like `createPool` and `getConnection`. While CommonJS `require` might work in older Node.js setups, ESM `import` is the recommended standard.
Connection
import { Connection } from 'dmdb';
import { DmConnection } from 'dmdb';
Type import for database connection objects, used for type-checking in TypeScript projects. The actual connection object is returned by `dmdb.getConnection()` or from a pool.
Pool
import { Pool } from 'dmdb';
Type import for connection pool objects, used for type-checking. The actual pool object is created via `dmdb.createPool()`.
OUT_FORMAT_ARRAY
import { OUT_FORMAT_ARRAY } from 'dmdb';
A constant used for `dmdb.outBindFormat` global configuration to ensure out-bind parameters are always returned as arrays, providing backward compatibility after v1.0.43524.

This quickstart demonstrates how to establish a connection pool, obtain a connection, execute a simple `SELECT` query, perform an `INSERT` with bind parameters, and properly close connections and the pool. It also includes a basic table setup/teardown.

import dmdb from 'dmdb'; interface MyQueryResult { id: number; name: string; } async function runDbOperations() { let connection: dmdb.Connection | undefined; let pool: dmdb.Pool | undefined; try { // Create a connection pool pool = await dmdb.createPool({ user: process.env.DB_USER ?? 'SYSDBA', password: process.env.DB_PASSWORD ?? 'SYSDBA', connectString: process.env.DB_CONNECT_STRING ?? 'localhost:5236/DAMENG', poolMin: 2, poolMax: 4, poolIncrement: 1, poolAlias: 'default' }); console.log('Connection pool created successfully.'); // Get a connection from the pool connection = await pool.getConnection(); console.log('Connection obtained from pool.'); // Execute a simple query const querySql = 'SELECT 1 AS id, \'Hello DMDB\' AS name FROM DUAL'; const result: dmdb.Result<MyQueryResult> = await connection.execute(querySql); console.log('Query Result:', result.rows?.[0]); // Execute a DML statement with bind parameters const insertSql = 'INSERT INTO my_test_table (id, value) VALUES (:1, :2)'; const bindParams = [1001, 'Test Value']; const insertResult = await connection.execute(insertSql, bindParams, { autoCommit: true }); console.log('Rows inserted:', insertResult.rowsAffected); // Execute a query to fetch data from the inserted table const fetchSql = 'SELECT id, value FROM my_test_table WHERE id = :id'; const fetchResult: dmdb.Result<{ id: number; value: string }> = await connection.execute(fetchSql, { id: 1001 }); console.log('Fetched data:', fetchResult.rows?.[0]); } catch (err: any) { console.error('Database operation failed:', err.message); } finally { if (connection) { try { await connection.close(); console.log('Connection released back to pool.'); } catch (closeErr: any) { console.error('Error closing connection:', closeErr.message); } } if (pool) { try { await pool.close(); console.log('Connection pool closed.'); } catch (poolCloseErr: any) { console.error('Error closing pool:', poolCloseErr.message); } } } } // A small helper to create the table if it doesn't exist async function setupTable() { let connection: dmdb.Connection | undefined; try { connection = await dmdb.getConnection({ user: process.env.DB_USER ?? 'SYSDBA', password: process.env.DB_PASSWORD ?? 'SYSDBA', connectString: process.env.DB_CONNECT_STRING ?? 'localhost:5236/DAMENG', }); await connection.execute(` BEGIN EXECUTE IMMEDIATE 'DROP TABLE my_test_table'; EXCEPTION WHEN OTHERS THEN IF SQLCODE != -942 THEN RAISE; END IF; END; `); await connection.execute(` CREATE TABLE my_test_table ( id NUMBER(10) PRIMARY KEY, value VARCHAR2(50) ) `); console.log('Table my_test_table ensured.'); } catch (err: any) { console.error('Table setup failed:', err.message); } finally { if (connection) { await connection.close(); } } } setupTable().then(() => runDbOperations());
Debug
Known issues
breakingThe format of `Results.outBinds` for `Connection.executeMany()` changed from row-grouped to column-grouped to align with OracleDB's behavior. Applications relying on the previous row-grouped format will need adjustment.
fix
Update application code to process `outBinds` as column-grouped arrays. Review the `index.d.ts` for updated interface definitions.
affects: >=1.0.48286
breakingThe `ResultSet.getRowCount()` interface has been removed because it is incompatible with forward-only result sets.
fix
Avoid using `getRowCount()`. If a row count is strictly necessary before iteration, consider using an aggregate query (e.g., `COUNT(*)`) instead or collecting all rows into an array first.
affects: >=1.0.48286
breakingThe default alias for connection pools has changed from `null` or `undefined` to `'default'`. Attempting to retrieve a pool without specifying an alias, or using a non-existent alias, will now result in an error.
fix
Explicitly specify the `'default'` alias when creating or retrieving connection pools, or ensure you use a consistent, named alias.
affects: >=1.0.48286
breakingThe return format of `Result.outBinds`/`Results.outBinds` is no longer fixed as an array. It now depends on whether bind parameters were positioned (returns array) or named (returns object).
fix
For backward compatibility, set the global configuration `dmdb.outBindFormat = dmdb.OUT_FORMAT_ARRAY` immediately after importing the driver. Otherwise, update your code to handle dynamic `outBinds` formats based on your bind parameter style.
affects: >=1.0.43524
breakingWhen binding `NaN`, `Infinity`, or `-Infinity` values as parameters, the driver now throws an error instead of implicitly binding them as `NULL`.
fix
Explicitly handle `NaN`, `Infinity`, and `-Infinity` values in your application logic. Convert them to `NULL` or other appropriate database-compatible values before binding if `NULL` is the desired behavior, or ensure they are not passed.
affects: >=1.0.43524
breakingThe default bind type for `number` parameters that represent integers has changed from `DOUBLE` to `BIGINT`. This may affect applications that rely on implicit type conversion or expect `DOUBLE` precision for integer values.
fix
Review SQL statements and bind parameter definitions. If `DOUBLE` precision is explicitly required for integer-like numbers, specify the bind type explicitly. Otherwise, ensure your database schema and application can handle `BIGINT`.
affects: >=1.0.38220
gotchaThe `snappy` and `snappyjs` dependencies are now optional. If Snappy compression is enabled on the DM8 server, one of these packages *must* be installed in your project, otherwise communication will fail.
fix
If DMDB server-side compression is enabled, ensure either `snappy` (for performance) or `snappyjs` (for compatibility) is explicitly installed as a dependency in your project: `npm install snappy` or `npm install snappyjs`.
affects: >=1.0.34946
breakingA previous feature allowing `ExecuteOptions.outFormat` to control `Result.outBinds` format (array/object) was rolled back due to conflicts with `typeorm-dm`. `outBinds` are now fixed to return as arrays again. This can cause breaking changes if you adopted the short-lived `outFormat` option.
fix
Remove any usage of `ExecuteOptions.outFormat` for controlling `outBinds`. Ensure your code expects `outBinds` to be an array, especially if you had adapted to the v1.0.31017 behavior.
affects: 1.0.33801
gotchaThe driver fixed an issue where date/time types had incorrect conversions in different time zones. Applications relying on the previous (incorrect) timezone behavior might see altered date/time values.
fix
Verify date and time handling in your application, especially if working with multiple time zones. Ensure your database and application explicitly handle time zone conversions as intended.
affects: >=1.0.32369
Errors
Common errors & fixes
[6067] 字符串截断
Error when inserting strings of certain lengths using bind parameters, likely due to internal buffer handling or length calculation issues.
fix
Upgrade to dmdb v1.0.48286 or later. Ensure your string lengths are within defined database column limits.
Bind param data failed by invalid param data type
Occurs when connecting to older database versions and attempting to insert long strings via bind parameters, indicating a mismatch in data type handling.
fix
Upgrade to dmdb v1.0.45146 or later. Consider upgrading your Dameng database server if the issue persists with older versions.
[-2002] 执行未准备SQL语句
Executing arbitrary SQL statements between fetching a query result set and iterating through that result set can lead to this error. Also, concurrent operations on ResultSet or Lob objects are not supported.
fix
Upgrade to dmdb v1.0.45146 or later. Avoid interleaved SQL execution or concurrent operations on `ResultSet` and `Lob` objects. Process one result set completely before executing other queries or operating on another `ResultSet`.
绑定参数个数过多
Providing more positional bind parameters than there are placeholders in the SQL statement.
fix
Ensure the number of bind parameters supplied in the `execute()` or `executeMany()` call exactly matches the number of placeholders (e.g., `:1`, `:2`, or `:name`) in your SQL statement.
[6057] 长度或偏移错误
Occurs when reading large fields (LOBs) containing emoji characters in stream mode, indicating an issue with length or offset calculation for multi-byte characters.
fix
Upgrade to dmdb v1.0.46190 or later. Ensure your database character set is correctly configured to handle multi-byte characters like emojis.
Upgrade
Version history
1.0.48286latest on npm
Audit
Dependencies
snappyoptionalOptional dependency for Snappy compression if enabled on the DM8 server. Offers better performance than snappyjs.
snappyjsoptionalOptional dependency for Snappy compression if enabled on the DM8 server. A pure JavaScript implementation with better compatibility on some platforms.
Agent activity
9 hits · last 30 days
node
8
Resources
dmdb — npm install dmdb · libregistry