How to fix Access Microsoft.ACE.OLEDB.16.0 not registered by calling from Apache CGI vbscript.vbs

Roberto Gonzalez-Delank 0 Reputation points
2023-04-11T18:00:56.72+00:00
Known problem by Microsoft
==========================
https://learn.microsoft.com/en-us/office/troubleshoot/access/cannot-use-odbc-or-oledb

My office Version
=================
Microsoft® Access® LTSC MSO (16.0.14332.20102) 64-Bit 

OS Version
==========
Microsoft Windows 10 Home
10.0.19045 Build 19045

Problem
=======
Unable to use the Access ODBC, OLEDB or DAO interfaces outside Office

Starting a bdb00.vbs as Apache24 CGI-BIN applikation could not instantiate the Provider=Microsoft.ACE.OLEDB.16.0

The Apache24 error message is:"Provider: class not registered: D:/Apache24/cgi-bin/bdb00.vbs"

I can see the COM Object CLSID on the Registry:{3BE786A2-0366-4F5C-9434-25CF162E475F}

Runing the script with cscript.exe instantiate the provider and script run as expected, only outside office in Apache24 have the problem.


Question:
=========
Is "Microsoft.ACE.OLEDB.16.0" outside office in the version "Microsoft® Access® LTSC MSO (16.0.14332.20102) 64-Bit" supported ?

If yes what can be wrong ?

This is a testscript:
=====================

'!c:\WINDOWS\system32\cscript.exe /nologo
Option Explicit
wscript.echo "Content-type: text/html" & vbcrlf
wscript.echo "<h1>Hello World One</h1>" 

Dim n
For n = 0 to 5
wscript.echo "<h2>" & n & " </h2>"
next

wscript.sleep 5000

Const connectString = "Provider=Microsoft.ACE.OLEDB.16.0;Data Source=C:\Users\Roberto\Documents\bdb00.accdb;User Id=Admin;Password=;"
Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adUseClient = 3
Dim objConnection, objRecordset
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordset  = CreateObject("ADODB.Recordset")
objConnection.Open connectString
wscript.sleep 5000
			 
objRecordset.CursorLocation = adUseClient
On Error Resume Next

objRecordset.Open "SELECT * FROM Standorte" , objConnection, adOpenStatic, adLockOptimistic

If Err.Number <> 0 Then
    'error handling:
    WScript.Echo "<p>" & Err.Number & " Srce: " & Err.Source & " Desc: " &  Err.Description & "</p>"
    Err.Clear
End If

wscript.echo "<h1>Hello World Two</h1>" 

Do While Not(objRecordset.EOF)
 wscript.echo "<p>" & objRecordset("Name") & " " & objRecordset("Firma") & "</p>"
 objRecordset.MoveNext
Loop


objRecordset.Close
objConnection.Close

Output of the script on the browser
===================================
Hello World One
0
1
2
3
4
5

-2147221164 Srce: Provider Desc: class not registered
Hello World Two

Thank you in advance... Roberto..
Microsoft 365 and Office | Access | Development
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.