Skip to content

chrissantamaria/pkg-node-adodb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pkg node-adodb demo

Example repo for vercel/pkg#736 demonstrating how to use node-adodb within a pkg executable. This was built for Windows-only usage since (as far as I'm aware) there are no suitable Microsoft Access drivers for node-adodb on non-Windows platforms.

Overview

The gist of this demo is that node-adodb spawns a CScript process when performing database actions which requires a valid path to a lib file adodb.js. In a standard Node environment this resolves to a copy stored within node_modules, but within a pkg executable this cannot be directly accessed.

To mitigate this, I've added a check to see if we're running within a pkg executable and have changed the ADODB.PATH to a location directly next to the executable. I then copy adodb.js from its original node_modules location to the set path, allowing CScript to access it.

This copying process could in theory be performed at build-time, though you would need to distribute your built app.exe and copied adodb.js together. I personally prefer keeping app.exe completely portable.

Instructions

Ensure that a Microsoft Access database named db.mdb is in the root project dir. Feel free to change the DB_PATH as necessary.

Install dependencies

yarn

Run in standard Node environment

node app.js

Build and run standalone executable

yarn build
app.exe

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published