Jet OLEDB:Engine on Windows7 (64bit) - Compact Access Database problem
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9

Thread: Jet OLEDB:Engine on Windows7 (64bit) - Compact Access Database problem

  1. #1
    Join Date
    Apr 2013
    Location
    Prague / Cracow
    Posts
    47

    Jet OLEDB:Engine on Windows7 (64bit) - Compact Access Database problem

    Hey ho!

    I'm using ADO in my WINAPI project with Microsoft.ACE.OLEDB.12 (msado26.tlb) with no problem, but now I need to be able to compact the database from my application and i've learnt that to do so i need to add msjro.dll to my project to execute the following code:

    Code:
    void db_compact()
    {
    	try
    {
       IJetEnginePtr jet(__uuidof(JetEngine));
      jet->CompactDatabase( "Provider=Microsoft.Jet.OLEDB.12.0;Data Source=d:\\xxx.accdb;Jet OLEDB:Database Password=test", 
    "Provider=Microsoft.Jet.OLEDB.12.0;Data Source=d:\\xxx.accdb;" 
    "Jet OLEDB:Engine Type=5;Jet OLEDB:Database Password=test");
    }
    catch(_com_error e) 
    {       
      errorhandler(e);  
    }
    	
    }
    IJetEnginePtr and JetEngine are properly recognized as classes in my Visual Studio but the problems is that when i try to import the JET dll itself by:
    Code:
    #import "C:\Program Files (x86)\Common Files\System\ado\msjro.dll" no_namespace
    my compiler gives the following errors:
    2 <path>\msjro.tlh IntelliSense: identifier "_Recordset_DeprecatedPtr" is undefined 196
    3 <path>\msjro.tlh IntelliSense: identifier "_Recordset_DeprecatedPtr" is undefined 224
    4 <path>\msjro.tlh error C2146: syntax error : missing ';' before identifier 'ConflictTables' 196
    5 <path>\msjro.tlh error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 196
    6 <path>\msjro.tlh error C2146: syntax error : missing ';' before identifier 'GetConflictTables' 224
    7 <path>\msjro.tlh error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 224
    8 <path>\msjro.tlh warning C4183: 'GetConflictTables': missing return type; assumed to be a member function returning 'int' 224
    1 <path>\msjro.tli IntelliSense: identifier "_Recordset_DeprecatedPtr" is undefined 111
    9 <path>\msjro.tli error C2143: syntax error : missing ';' before 'IReplica::GetConflictTables' 111
    10 <path>\msjro.tli error C2433: '_RecordsetPtr' : 'inline' not permitted on data declarations 111
    11 <path>\msjro.tli error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 111
    12 <path>\msjro.tli error C2064: term does not evaluate to a function taking 2 arguments 115
    I cannot find any threat that gives some resolution to this problem which (from what i've read) apparently appears on WIN7 64 bit only (my OS!) although the application i compile is a WIN32.

    Has anyone heard about any solution for this? From what i've read on other forums the JET does not go together with 64 Win7 but somehowe I have it installed. Only my compilator doesn't understand those certain parts of msjro.tlh and .tli... while importing that msjro.dll. I am a bit lost... :-0

    will be grateful for any hint!

    cheers
    b.
    Last edited by berkov; June 20th, 2013 at 12:46 AM.

  2. #2
    Join Date
    Apr 2013
    Location
    Prague / Cracow
    Posts
    47

    Re: Jet OLEDB:Engine on Windows7 (64bit) - Compact Access Database problem

    OK.. seems i have found it.
    for win7 64 i need to also use msado60.tlb, so i commented my previous msado26.tlb and used msado60.tlb with msjro.dll instead, like this:

    Code:
    //#import "C:\Program Files\Common Files\System\ado\msado26.tlb" rename( "EOF", "ADOEOF" )
    #import "C:\Program Files (x86)\Common Files\System\ado\msado60.tlb" rename( "EOF", "ADOEOF" )
    #import "C:\Program Files (x86)\Common Files\System\ado\msjro.dll" no_namespace
    but now, i'm getting following error.
    when on runtime i call for my function db_compact() i get from my errorhandler(e) function the following MessageBox:
    "Class not registered" (which is e.Description())
    - 2147221164 (which is e.Error())
    "Class not registered" (which is e.ErrorMessage())

    Any ideas why?

  3. #3
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,360

    Re: Jet OLEDB:Engine on Windows7 (64bit) - Compact Access Database problem

    Did you google?
    For example, thid discussion: http://www.vbforums.com/showthread.p...stered-problem
    Victor Nijegorodov

  4. #4
    Join Date
    Apr 2013
    Location
    Prague / Cracow
    Posts
    47

    Re: Jet OLEDB:Engine on Windows7 (64bit) - Compact Access Database problem

    Quote Originally Posted by VictorN View Post
    Did you google?
    For example, thid discussion: http://www.vbforums.com/showthread.p...stered-problem
    your link does not really seem to be my case.

    yep, i've searched the internet and have not really found anything useful.
    in most of the threats it says something like:
    "Jet OLEDB is depricated and is not installed with operating system since MDAC 2.6 (might be 2.5). Anyway, you need to use new ACE OLEDB provider instead of Jet in your applications and install it on target PC where application should run. "
    but i cannot use ACE coz it does not contain IJetEnginePtr which i need to compact my database. this all is so confusing to me.

    to make it confusing even more, when i tried to compile the same code on my company PC (also win7 and 64 bit) i got exactly the same problems as described in my original post and could not even compile it!

  5. #5
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,360

    Re: Jet OLEDB:Engine on Windows7 (64bit) - Compact Access Database problem

    Well, in this link there is information that unistalling of IE10 (if it was installed) might help.
    Victor Nijegorodov

  6. #6
    Join Date
    Apr 2013
    Location
    Prague / Cracow
    Posts
    47

    Re: Jet OLEDB:Engine on Windows7 (64bit) - Compact Access Database problem

    Quote Originally Posted by VictorN View Post
    Well, in this link there is information that unistalling of IE10 (if it was installed) might help.
    i am using IE8 - and i don't really think it might be anyhow connected.

  7. #7
    Join Date
    Apr 2013
    Location
    Prague / Cracow
    Posts
    47

    Re: Jet OLEDB:Engine on Windows7 (64bit) - Compact Access Database problem

    Hey ho.. got a bit closer...
    I'm using JET (not ACE) and it seems that the highest version in JET is 4 (not 12), so my string should look like this:

    CompactDatabase( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\\xxx.accdb;Jet OLEDB: Database Password=test",
    "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\\xxx.accdb;"
    "Jet OLEDB:Engine Type=5;Jet OLEDB: Database Password=test");


    Now i'm getting the following error:
    2147467259
    Unrecognized database format.

    Is there any way i can make my CompactDatabase work with new accdb? Have they really stopped supporting it?
    will keep searching....

  8. #8
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,360

    Re: Jet OLEDB:Engine on Windows7 (64bit) - Compact Access Database problem

    Quote Originally Posted by berkov View Post
    Hey ho.. got a bit closer...
    I'm using JET (not ACE) and it seems that the highest version in JET is 4 (not 12)...
    AFAIK JET does not work with .accdb files. It is only for .mdb. Thus you got this "Unrecognized database format" error.
    You might want also to read this discussion: http://stackoverflow.com/questions/1...se-by-net-code
    Victor Nijegorodov

  9. #9
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    3,845

    Re: Jet OLEDB:Engine on Windows7 (64bit) - Compact Access Database problem

    you cannot load a 32bit COM dll (msjro.dll) from a 64bit application.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center