locked
JetEngine Compact feature is not working in Winserver2008 64 bit RRS feed

  • Question


  • We have found some issues related to access database JetEngine Compact feature. A COM exception "Retrieving the COM class factory for component with CLSID {DE88C160-FF2C-11D1-BB6F-00C04FAE22DA} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))." occurred while creating the Jet Engine instance. This issue occurred in WinServer2008 64bit. Same code piece works fine in WinXP 32bit.

    Please not that Access Database Engine 2010 is already available/installed on the system.

    the Code piece used is given below: the code for create an instance of a Jet Replication Object throws the COM exception. Please review and comment.

    string accessDBFullName = string.Format("{0}\\{1}", ICECommonInterface.DatabasePath, this._dbHandler.DatabaseName); //create an instance of a Jet Replication Object object objJRO = Activator.CreateInstance(Type.GetTypeFromProgID("JRO.JetEngine"));

    //filling Parameters array //cnahge "Jet OLEDB:Engine Type=5" to an appropriate value // or leave it as is if you db is JET4X format (access 2000,2002) //(yes, jetengine5 is for JET4X, no misprint here) oParams = new object[] {@"Provider=Microsoft.Ace.OLEDB.12.0;Data Source = " + accessDBFullName + @";Persist Security Info=False", "Provider=Microsoft.Jet.OLEDB.4.0;Data" + " Source=C:\\tempdb.mdb;Jet OLEDB:Engine Type=5"}; //invoke a CompactDatabase method of a JRO object //pass Parameters array objJRO.GetType().InvokeMember("CompactDatabase", System.Reflection.BindingFlags.InvokeMethod, null, objJRO, oParams); //database is compacted now //to a new file C:\\tempdb.mdw //let's copy it over an old one and delete it System.IO.File.Delete(accessDBFullName); System.IO.File.Move("C:\\tempdb.mdb", accessDBFullName); //clean up (just in case) System.Runtime.InteropServices.Marshal.ReleaseComObject(objJRO); objJRO = null; } catch (Exception ex) { throw ex; }


    • Edited by SMathew1979 Tuesday, March 22, 2016 11:47 AM typo
    Tuesday, March 22, 2016 11:45 AM

Answers