npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mdb-to-sql

v1.0.1

Published

Converts .mdb (Microsoft Access) files to .sql from the command line

Readme

mdb-to-sql

npm version npm downloads node version license PRs welcome

Convert Microsoft Access .mdb files into portable .sql dumps with a single command.

mdb-to-sql is a lightweight CLI for developers migrating legacy Access systems to modern stacks. It runs with pure Node.js and does not require Microsoft Access, ODBC drivers, Java, or OS-level tools.

Quick Start

npx mdb-to-sql ./path/to/database.mdb

This creates ./path/to/database.sql in the same directory as the input file.

Why this tool

  • Simple CLI workflow: run one command and generate a .sql dump
  • Cross-platform: works on macOS, Linux, and Windows with Node.js
  • No system dependencies: no mdb-tools, no Java, no Access installation
  • Migration-friendly output: clear progress logging and conversion summary
  • Version-control friendly: text-based SQL output is easy to diff and review

Features

  • Reads .mdb files (Access 97–2003)
  • Exports all tables found in the source file
  • Creates output .sql in the same directory with the same base name
  • Writes SQL with CREATE TABLE IF NOT EXISTS + batch INSERT INTO
  • Maps common Access value types to portable SQL types
  • Returns explicit process exit codes for CI/CD and automation

Installation

Run directly with npx (recommended)

npx mdb-to-sql ./path/to/database.mdb

Install globally

npm install -g mdb-to-sql
mdb-to-sql ./path/to/database.mdb

Install as a project dependency

npm install mdb-to-sql
npx mdb-to-sql ./path/to/database.mdb

Requirements

  • Node.js >=16

Usage

npx mdb-to-sql <path-to-file.mdb>

Example:

npx mdb-to-sql ./data/database.mdb

Output file:

  • Input: ./data/database.mdb
  • Output: ./data/database.sql

Example CLI output

──────────────────────────────────────────────────────
🚀 MDB → SQL Converter
   Fast conversion from Microsoft Access (.mdb) to portable SQL
──────────────────────────────────────────────────────
📥 Source -> /path/to/database.mdb
📥 Output -> /path/to/database.sql
──────────────────────────────────────────────────────
📚 Tables found: 3

✓ "products"  25 rows • 11 columns
✓ "customers" 38 rows • 3 columns
✓ "orders"    14 rows • 9 columns
──────────────────────────────────────────────────────
✅ Conversion completed successfully

Tables      -> 3 converted
Rows        -> 77
Size        -> 16.0 KB
File        -> /path/to/database.sql
──────────────────────────────────────────────────────

Example generated SQL

-- Generated by mdb-to-sql v1.0.0
-- Source: /path/to/database.mdb
-- Date  : 2026-05-07T00:00:00.000Z

-- --------------------------------------------------------
-- Table: customers
-- --------------------------------------------------------

CREATE TABLE IF NOT EXISTS `customers` (
  `id` INTEGER,
  `name` TEXT
);

INSERT INTO `customers` (`id`, `name`) VALUES
  (1, 'Alice'),
  (2, 'Bob');

Exit codes

  • 0 - Conversion completed successfully
  • 1 - Invalid arguments, file not found, or unsupported extension
  • 2 - Error while reading/parsing the .mdb file
  • 3 - Error while writing the .sql file

Error messages

No argument:

Usage: mdb-to-sql <path-to-file.mdb>

File not found:

Error: File not found: ./does-not-exist.mdb

Unsupported extension:

Error: Only .mdb files are supported in this version.

Type handling

The converter normalizes common Access values to SQL literals:

  • Text/Memo -> TEXT
  • Integer/Long Integer/Byte -> INTEGER
  • Single/Double/Currency/Numeric -> REAL
  • Boolean -> INTEGER (0/1)
  • Date/Time -> ISO-8601 TEXT
  • null/undefined -> NULL

Known limitations (v1.0)

  • .accdb is not supported
  • Table filtering is not available (all tables are exported)
  • Custom output path is not available
  • Dialect-specific output flags are not available yet
  • Access queries, forms, and macros are not migrated
  • Indexes/foreign keys are not exported in this version

Roadmap

Planned improvements for future versions:

  • .accdb support
  • --output <path> option
  • --tables <t1,t2> table selection
  • --dialect <mysql|postgres|sqlite> option
  • --dry-run mode
  • --verbose detailed logs
  • --no-create mode (INSERT-only output)

Contributing

Contributions are welcome. To contribute:

  1. Open an issue describing the bug or feature request
  2. Fork the repository and create a focused branch
  3. Add tests or reproduction steps when possible
  4. Open a pull request with a clear description of the change

License

MIT