{"id":17201,"library":"db-info","title":"Relational Database Metadata Utility","description":"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.","status":"abandoned","version":"0.0.3","language":"javascript","source_language":"en","source_url":"git://github.com/nearinfinity/node-db-info","tags":["javascript","database","db","sqlite","mysql","PostgreSQL","oracle","db-oracle"],"install":[{"cmd":"npm install db-info","lang":"bash","label":"npm"},{"cmd":"yarn add db-info","lang":"bash","label":"yarn"},{"cmd":"pnpm add db-info","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Utility for managing asynchronous operations, a direct runtime dependency mentioned in installation instructions.","package":"async","optional":false},{"reason":"Required for SQLite database driver, if 'sqlite3' is specified as the driver option.","package":"sqlite3","optional":true},{"reason":"Required for MySQL database driver, if 'mysql' is specified as the driver option.","package":"mysql","optional":true},{"reason":"Required for PostgreSQL database driver, if 'pg' is specified as the driver option. (Listed on npm registry page).","package":"pg","optional":true},{"reason":"Required for Oracle database driver, if 'db-oracle' is specified as the driver option. (Listed on npm registry page).","package":"db-oracle","optional":true}],"imports":[{"note":"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.","wrong":"import dbinfo from 'db-info';","symbol":"dbinfo","correct":"const dbinfo = require('db-info');"},{"note":"The primary functionality `getInfo` is accessed as a method on the default CommonJS export. Destructuring is not supported.","wrong":"import { getInfo } from 'db-info';","symbol":"getInfo","correct":"const dbinfo = require('db-info');\ndbinfo.getInfo(...);"}],"quickstart":{"code":"const sqlite3 = require('sqlite3').verbose();\nconst dbinfo = require('db-info');\n\n// Create an in-memory SQLite database for demonstration\nconst db = new sqlite3.Database(':memory:', (err) => {\n  if (err) {\n    return console.error(err.message);\n  }\n  console.log('Connected to the in-memory SQLite database.');\n\n  // Create a dummy table\n  db.run(`CREATE TABLE users (\n    id INTEGER PRIMARY KEY AUTOINCREMENT,\n    name TEXT NOT NULL,\n    email TEXT UNIQUE,\n    age INTEGER\n  )`, (err) => {\n    if (err) {\n      // Table might already exist if run multiple times in same process\n      if (err.message.includes('already exists')) {\n        console.log('Table \"users\" already exists, proceeding.');\n      } else {\n        return console.error('Error creating table:', err.message);\n      }\n    } else {\n      console.log('Table \"users\" created successfully.');\n    }\n\n    // Get database metadata using db-info\n    dbinfo.getInfo({\n      driver: 'sqlite3',\n      db: db\n    }, function(err, result) {\n      if (err) {\n        return console.error('Error getting DB info:', err.message);\n      }\n      console.log('Database metadata retrieved:');\n      console.log(JSON.stringify(result, null, 2));\n\n      // Close the database connection\n      db.close((err) => {\n        if (err) {\n          return console.error(err.message);\n        }\n        console.log('Closed the database connection.');\n      });\n    });\n  });\n});","lang":"javascript","description":"Demonstrates how to initialize `db-info` with an existing SQLite database connection to retrieve its table and column metadata."},"warnings":[{"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.","message":"The 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.","severity":"breaking","affected_versions":"All versions (0.0.3)"},{"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.","message":"This 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.","severity":"gotcha","affected_versions":"All versions (0.0.3)"},{"fix":"Manually manage and configure modern database drivers and use their native introspection capabilities, or use a contemporary ORM/query builder.","message":"The 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.","severity":"deprecated","affected_versions":"All versions (0.0.3)"},{"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.","message":"The 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.","severity":"gotcha","affected_versions":"All versions (0.0.3)"},{"fix":"Audit `npm ls` for transitive dependencies and their versions. The primary fix is to avoid this abandoned package entirely.","message":"The 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.","severity":"gotcha","affected_versions":"All versions (0.0.3)"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"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.","cause":"Attempting to use `require` in an ES module environment (e.g., in a file with `\"type\": \"module\"` in `package.json` or a `.mjs` file).","error":"TypeError: require is not a function"},{"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.","cause":"A required database driver (e.g., `sqlite3`, `mysql`, `pg`, `db-oracle`) is not installed or available in the project's `node_modules`.","error":"Error: Cannot find module 'sqlite3'"},{"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.","cause":"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.","error":"Error: Callback was already called."},{"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.","cause":"The target database server (e.g., MySQL, PostgreSQL, Oracle) is not running, is configured incorrectly, or network access is blocked by a firewall.","error":"Error: connect ECONNREFUSED"}],"ecosystem":"npm","meta_description":null}