Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QT VS TOOLS - "QODBC3: Unable to connect", "[Microsoft][Driver Manager ODBC]



  • I'm not working I do not connect to the database access via QT VS TOOLS in visual Studio.
    For use QtWebEngine i work in VS2017 Community d Qt VS Tools.
    I have testing driver ODBC with service connect database with into a string connection and all it's ok
    My project into QT it connects. Into Vs 2017 i have error:

    QSqlError("0", "QODBC3: Unable to connect", "[Microsoft][Driver Manager ODBC] Nome origine dati non trovato e driver predefinito non specificato.")
    

    This is connect in VS 2017 thai i try inserting name file fix.

    db.setDatabaseName("DRIVER={Microsoft Access Driver (*.mdb)};FIL={MS Access};DBQ=C:\folderdatabase\namedatabase.mdb");
    

    This is connect in QT that work

    db.setDatabaseName("DRIVER={Microsoft Access Driver (*.mdb)};FIL={MS Access};DBQ=" + path_and_name_db);
    


  • You should not use '\' within Strings!!

    change
    db.setDatabaseName("DRIVER={Microsoft Access Driver (.mdb)};FIL={MS Access};DBQ=C:\folderdatabase\namedatabase.mdb");
    to
    db.setDatabaseName("DRIVER={Microsoft Access Driver (
    .mdb)};FIL={MS Access};DBQ=C:\\folderdatabase\\namedatabase.mdb");
    or
    db.setDatabaseName("DRIVER={Microsoft Access Driver (*.mdb)};FIL={MS Access};DBQ=C:/folderdatabase/namedatabase.mdb");

    and it should work



  • If the filename separator issue doesn't fix your problem, it could be an issue with the version of the ODBC drivers you have installed. It's been a while since I've used ODBC with an Access file, but I remember that I was not able to connect to an Access database file with a 64-bit application when I had 32-bit MS Office (and 32-bit MS ODBC drivers) installed. I can't remember the exact error, but I remember that it wasn't immediately clear from the error message that this was the issue. There is a 64-bit version of the drivers you can download and install, but I don't think they co-existed well with the 32-bit versions still installed. There may be workarounds that I was not aware of. This might not even what is causing your problem.



  • @mchinand said in QT VS TOOLS - "QODBC3: Unable to connect", "[Microsoft][Driver Manager ODBC]:

    If the filename separator issue doesn't fix your problem, it could be an issue with the version of the ODBC drivers you have installed. It's been a while since I've used ODBC with an Access file, but I remember that I was not able to connect to an Access database file with a 64-bit application when I had 32-bit MS Office (and 32-bit MS ODBC drivers) installed. I can't remember the exact error, but I remember that it wasn't immediately clear from the error message that this was the issue. There is a 64-bit version of the drivers you can download and install, but I don't think they co-existed well with the 32-bit versions still installed. There may be workarounds that I was not aware of. This might not even what is causing your problem.

    I think the reason is just that.
    I installed Office 365 64bit and VisualStudio 2017 64bit
    I also looked for directions on how to check which version of odbc and it seems to be 64bit too.

    Do you know the method to be certain of which ODBC Access is installed? (the pc that I use business and many things were already present)



  • @elicat

    The problem is solved.
    Workaround:
    to install the 64-bit Access Database Engine 2010 on a computer with 32-bit Microsoft Office 2007, 2010, or 2013.

    Look this articles : How-to-install-64-bit-Microsoft-Database-Drivers-alongside-32-bit-Microsoft-Office


Log in to reply