Important: Please read the Qt Code of Conduct -

QOCDB + MacOS + Access = crash at open()

  • Hi everyone!

    I've been having an issue while trying to connect on a simple access database on macOS. I use qt 5.11 that I installed with "brew" in wich I copied a compiled version of the QOSDB plugin, compiled also with qt 5.11 from the sources.

    So my code is this:

     QSqlDatabase db = QSqlDatabase::addDatabase("QODBC3");
      db.setDatabaseName(fileName.prepend("Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ="));
      qDebug() << "Is driver available:" << db.isDriverAvailable("QODBC");
      qDebug() << "Drivers:" << db.drivers();
      qDebug() << "Db is valid:" << db.isValid();
      qDebug() << "Last error:" << db.lastError();
        qDebug() << "oK";
        qDebug() << db.lastError().text();

    And the result is this:

    "Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=/Users/paralax/CloudStation/Projects/Libraries/Altium/Antenna.accdb"
    Is driver available: true
    Drivers: ("QSQLITE", "QODBC", "QODBC3")
    Db is valid: true
    Last error: QSqlError("", "", "")

    Unluckily, It crashes on the line And the debugger is of no help :s

    I have unixocdb and freedts installed with brew. I guess there is a problem with my environment setup, but I don't know where. Any idea?

    Thanks in advance!

  • Hi, freetds works fine with SQL Server, but is no good for opening an Access database, you need a Windows computer :-(

  • Damit microsoft!

    Thanks for your answer. Isn't there any other way to connect to those database? Any other lib or plugin of some sort?

  • Well, I had the same problem some time again on Ubuntu, and on Linux there's MDB Tools which opened my Access files ok.

    With a bit of luck MDB Tools could be available via Homebrew...

Log in to reply