Registry / database / db-info

db-info

JSON →
library0.0.3jsnpmunverified

The `db-info` package is a Node.js utility designed to provide a database-agnostic interface for retrieving relational database metadata, such as table and column schemas. It supports SQLite3, MySQL, PostgreSQL, and Oracle databases by leveraging older versions of `node-sqlite3`, `node-mysql`, `node-postgres`, and `node-oracle` drivers. The current and only known version is 0.0.3, last published in April 2012. Given its age and lack of updates for over a decade, this package is definitively abandoned and not actively maintained. Its API is entirely callback-based, reflecting Node.js development patterns from its release era. Key differentiators at the time were its unified interface across multiple database types for schema introspection, but it is now highly outdated compared to modern ORMs or database toolkit solutions.

npm install db-info
INSTALL
IMPORT
SIG · DB-INFO
D
db-info
databasejavascriptv0.0.3
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.

dbinfo
const dbinfo = require('db-info');
import dbinfo from 'db-info';
This package is CommonJS-only and does not support ES modules. Attempting to import with `import` syntax will result in a runtime error in ES module contexts.
getInfo
const dbinfo = require('db-info'); dbinfo.getInfo(...);
import { getInfo } from 'db-info';
The primary functionality `getInfo` is accessed as a method on the default CommonJS export. Destructuring is not supported.

Demonstrates how to initialize `db-info` with an existing SQLite database connection to retrieve its table and column metadata.

const sqlite3 = require('sqlite3').verbose(); const dbinfo = require('db-info'); // Create an in-memory SQLite database for demonstration const db = new sqlite3.Database(':memory:', (err) => { if (err) { return console.error(err.message); } console.log('Connected to the in-memory SQLite database.'); // Create a dummy table db.run(`CREATE TABLE users ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, email TEXT UNIQUE, age INTEGER )`, (err) => { if (err) { // Table might already exist if run multiple times in same process if (err.message.includes('already exists')) { console.log('Table "users" already exists, proceeding.'); } else { return console.error('Error creating table:', err.message); } } else { console.log('Table "users" created successfully.'); } // Get database metadata using db-info dbinfo.getInfo({ driver: 'sqlite3', db: db }, function(err, result) { if (err) { return console.error('Error getting DB info:', err.message); } console.log('Database metadata retrieved:'); console.log(JSON.stringify(result, null, 2)); // Close the database connection db.close((err) => { if (err) { return console.error(err.message); } console.log('Closed the database connection.'); }); }); }); });
Debug
Known issues
breakingThe package is abandoned and has not been updated since 2012. It requires Node.js >=0.6.0 and is highly unlikely to be compatible with modern Node.js versions (e.g., Node.js 16+), modern database drivers, or contemporary security practices.
fix
Consider using modern alternatives like ORMs (e.g., Prisma, TypeORM, Sequelize) or database query builders that are actively maintained and support current Node.js and database versions.
affects: All versions (0.0.3)
gotchaThis package is CommonJS-only (`require`). It cannot be directly `import`ed in an ES module project without explicit transpilation or wrapper functions, which might introduce further compatibility issues due to its age.
fix
Ensure your project is configured for CommonJS or use a dynamic `import()` statement if absolutely necessary, but migration to a modern library is strongly recommended.
affects: All versions (0.0.3)
deprecatedThe underlying database drivers it supports (e.g., `node-sqlite3`, `node-mysql`, `node-postgres`, `node-oracle`) have evolved significantly since 2012. Using this package likely means relying on very old, potentially insecure, and unmaintained versions of these drivers.
fix
Manually manage and configure modern database drivers and use their native introspection capabilities, or use a contemporary ORM/query builder.
affects: All versions (0.0.3)
gotchaThe API is exclusively callback-based, which is an outdated pattern in modern JavaScript/Node.js. It does not support Promises or async/await natively, leading to callback hell if integrating with modern asynchronous code.
fix
If forced to use, wrap `getInfo` in a Promise-returning function using `util.promisify` (if compatible) or a manual Promise constructor, but anticipate other compatibility issues.
affects: All versions (0.0.3)
gotchaThe package lists `async` as a dependency which likely refers to a very old version of the `async` library. This old version might have its own compatibility issues or even known vulnerabilities.
fix
Audit `npm ls` for transitive dependencies and their versions. The primary fix is to avoid this abandoned package entirely.
affects: All versions (0.0.3)
Errors
Common errors & fixes
TypeError: require is not a function
Attempting to use `require` in an ES module environment (e.g., in a file with `"type": "module"` in `package.json` or a `.mjs` file).
fix
This package is CommonJS-only. Either configure your project for CommonJS (`"type": "commonjs"` in `package.json` or use `.cjs` extensions) or find a modern, actively maintained alternative. Dynamic `import()` might technically work but is not recommended for an abandoned package.
Error: Cannot find module 'sqlite3'
A required database driver (e.g., `sqlite3`, `mysql`, `pg`, `db-oracle`) is not installed or available in the project's `node_modules`.
fix
Install the specific driver needed using npm: `npm install sqlite3` (or `mysql`, `pg`, `db-oracle`). Note that older versions of these drivers might be required for compatibility with `db-info` itself.
Error: Callback was already called.
A common issue in callback-based APIs where the callback function provided to `getInfo` is invoked multiple times, often due to error handling logic not returning early after an error.
fix
Review the code invoking `dbinfo.getInfo` to ensure the callback is only called once per execution path. This often requires careful `if (err) return callback(err);` patterns.
Error: connect ECONNREFUSED
The target database server (e.g., MySQL, PostgreSQL, Oracle) is not running, is configured incorrectly, or network access is blocked by a firewall.
fix
Verify the database server is running and accessible from the machine executing the Node.js application. Check connection parameters (host, port, user, password, database) for correctness and ensure no firewall rules are blocking the connection.
Upgrade
Version history
0.0.3latest on npm
Audit
Dependencies
asyncrequiredUtility for managing asynchronous operations, a direct runtime dependency mentioned in installation instructions.
sqlite3optionalRequired for SQLite database driver, if 'sqlite3' is specified as the driver option.
mysqloptionalRequired for MySQL database driver, if 'mysql' is specified as the driver option.
pgoptionalRequired for PostgreSQL database driver, if 'pg' is specified as the driver option. (Listed on npm registry page).
db-oracleoptionalRequired for Oracle database driver, if 'db-oracle' is specified as the driver option. (Listed on npm registry page).
Agent activity
16 hits · last 30 days
node
14
Amazon
1
Resources