Published by Roman on 30 Oct 2009
Microsoft.Jet.OLEDB.4.0 ProgID is not available (Windows 7 but probably not only)
It was a sort of ridiculous problem: an attempt to instantiate a Microsoft.Jet.OLEDB.4.0 object failed with error. Still some applications are still running without problems connecting to Jet daabases, how comes?
There has been a number of posts on Internet, but none of the top ones appeared to be relevant.
The problem is reproduced extremely simple:
int _tmain(int argc, _TCHAR* argv[]) { ATLVERIFY(SUCCEEDED(CoInitialize(NULL))); { //CoLoadLibrary(L"C:\\Program Files (x86)\\Common Files\\System\\Ole DB\\oledb32.dll", TRUE); CComPtr<IDBInitialize> pDbInitialize; const HRESULT nResult = pDbInitialize.CoCreateInstance(L"Microsoft.Jet.OLEDB.4.0", NULL, CLSCTX_INPROC_SERVER); _tprintf(_T("nResult 0x%08x\n"), nResult); } CoUninitialize(); return 0; }
Oops, the code gives error REGDB_E_CLASSNOTREG 0×80040154 “Class not registered”. It looked like system was unable to locate one of the internally used DLLs – oledb32.dll, and if we help by uncommenting the line commented in the code snippet above, the error changes to ERROR_MOD_NOT_FOUND 0×8007007e “The specified module could not be found”.
The problem appears to be that one of the system components, which is involved, “Microsoft OLE DB Data Conversion Library” is registered with the system using a REG_EXPAND_SZ value, to be located using path “%CommonProgramFiles(x86)%\System\Ole DB\oledb32.dll”. It is obvious that CommonProgramFiles(x86) is placeholder to be expanded, but does the expansion succeed?




