Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get it to work with .mdb files #464

Open
isrhedden opened this issue Jan 11, 2022 · 0 comments
Open

Can't get it to work with .mdb files #464

isrhedden opened this issue Jan 11, 2022 · 0 comments

Comments

@isrhedden
Copy link

My application works perfectly fine with .accdb Access files but when I try to connect to .mdb Access files I get this error Spawn C:\Windows\SysWOW64\cscript.exe error, Provider cannot be found. It may not be properly installed. My code works on my local Windows computer with both .mdb and .accdb, so I'm guessing that it's something to do with how my container environment is set up.

Below is the code for my base Dockerfile:

# Get base Windows OS image
FROM mcr.microsoft.com/windows/servercore:ltsc2019

# Set environment variables
ENV NPM_CONFIG_LOGLEVEL info
ENV NODEJS_VERSION 12.9.1

# Download & Install 2010 32bit Access Driver
ADD https://download.microsoft.com/download/2/4/3/24375141-E08D-4803-AB0E-10F2E3A07AAA/AccessDatabaseEngine.exe AccessDatabaseEngine.exe
RUN powershell -Command "Start-Process -NoNewWindow -FilePath \"AccessDatabaseEngine.exe\""

# Download and install Node.js
ADD https://nodejs.org/dist/v12.9.1/node-v12.9.1-x64.msi node.msi
RUN msiexec.exe /q /i node.msi

# Run node
CMD [ "node" ]

I establish the Access connection like so. How I instantiate the connection differs depending on if I'm in my local environment or online. It also differs on .accdb vs .mdb:

  // Define connection vars depending on if it's a .accdb .mdb file
  const fileExt = file.path.split('.').pop();
  const connStrAccdb = `Provider=Microsoft.ACE.OLEDB.12.0;Data Source=${file.path};Persist Security Info=False;`; // This fails
  const connStrMdb = `Provider=Microsoft.Jet.OLEDB.4.0;Data Source=${file.path};`; // This works
  const connStr = fileExt === "accdb" ? connStrAccdb : connStrMdb;

  // Initialize export connection depending on if we are local or live
  let access;
  const use64 = process.env.NODE_ENV === "development" ? true : false;
  if (use64) {
      access = ADODB.open(connStr, use64);
  } else {
      access = ADODB.open(connStr);
  }

Is there another software package that I need to install in order to work with .mdb files? Do I need to connect in a different way? Any help would be very much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant