mdb-to-sql
v1.0.1
Published
Converts .mdb (Microsoft Access) files to .sql from the command line
Maintainers
Readme
mdb-to-sql
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.mdbThis 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
.sqldump - 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
.mdbfiles (Access 97–2003) - Exports all tables found in the source file
- Creates output
.sqlin the same directory with the same base name - Writes SQL with
CREATE TABLE IF NOT EXISTS+ batchINSERT 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.mdbInstall globally
npm install -g mdb-to-sql
mdb-to-sql ./path/to/database.mdbInstall as a project dependency
npm install mdb-to-sql
npx mdb-to-sql ./path/to/database.mdbRequirements
- Node.js
>=16
Usage
npx mdb-to-sql <path-to-file.mdb>Example:
npx mdb-to-sql ./data/database.mdbOutput 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 successfully1- Invalid arguments, file not found, or unsupported extension2- Error while reading/parsing the.mdbfile3- Error while writing the.sqlfile
Error messages
No argument:
Usage: mdb-to-sql <path-to-file.mdb>File not found:
Error: File not found: ./does-not-exist.mdbUnsupported 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)
.accdbis 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:
.accdbsupport--output <path>option--tables <t1,t2>table selection--dialect <mysql|postgres|sqlite>option--dry-runmode--verbosedetailed logs--no-createmode (INSERT-only output)
Contributing
Contributions are welcome. To contribute:
- Open an issue describing the bug or feature request
- Fork the repository and create a focused branch
- Add tests or reproduction steps when possible
- Open a pull request with a clear description of the change
License
MIT
