Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Solved How use MS Access database on 64bit program with 32bit Office

    General and Desktop
    microsoft acces bitness database driver database odbc p mdb
    1
    2
    300
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Alex Rus
      Alex Rus last edited by Alex Rus

      Good day to all! I’ve been sitting on this task for SOME time and I don’t like creating topics myself, but I don’t find another option :
      Given:

      • My 64bit Windows program (Qt Creator 4.8.0, MinGW 64 compiler);
      • Target computer on 64bit Windows which may or may not include 32bit or 64bit Microsoft Office (any year);
      • Microsoft Access Database Engine 2010 (this version is needed - the file should work in 2010 version of the program).

      Task:
      My program should have the ability to read and modify data in .mdb database.

      Current solution:
      Use QSqlDatabase and QODBC:

      QSqlDatabase m_db = QSqlDatabase::addDatabase("QODBC");
      m_db.setDatabaseName("DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};DSN='';DBQ=c:\\targetDB.mdb;");
      

      Problem:
      When 64bit Office and Access drivers are installed on the computer - everything works.
      However, if there is 32bit version of Office and Access - an error:
      [Driver Manager]Data source name not found, and no default driver specified QODBC3: Unale to connect

      • As far as I know, you can’t just install 64bit versions of MS Access drivers on PC with 32x office version;
      • But even if you do, it (spied here and here), when you try to connect / create a database or source data, an error pops up:
        alt text
      • Yes, I tried different options for the connection string;
      • I tried to Indicated a specific driver in the connection string - also did not help:
      m_db.setDatabaseName("DRIVER=С:\\*pathToAccesDrivers* \\ACEODBC.DLL;DBQ=c:\\targetDB.mdb;");
      

      So yeah, in total:

      • Is it possible to somehow use 64 drivers directly? Or correctly install both version (or 64x on 32x Office) Access Database Engine and use it?
      • Are there any other ways to work with .mdb files? I came across this code and the mention of some “CData Access Source”, but so far, I couldn't figure it out.
      • Any other ideas! Counting on you :>
      1 Reply Last reply Reply Quote 0
      • Alex Rus
        Alex Rus last edited by

        There was no solution, I had to sweat with the 32x version, which is installed if the Office is same bitness.

        1 Reply Last reply Reply Quote 2
        • First post
          Last post