Results 1 to 6 of 6

Thread: QSqlDatabase: QODBC driver not loaded - problem

  1. #1

    Default QSqlDatabase: QODBC driver not loaded - problem

    Hi

    I have the following code :

    Qt Code:
    1. #include "mainwindow.h"
    2. #include "ui_mainwindow.h"
    3. #include <QDebug>
    4. #include <QSqlDatabase>
    5. #include <QSqlQuery>
    6.  
    7.  
    8.  
    9. MainWindow::MainWindow(QWidget *parent) :
    10. QMainWindow(parent),
    11. ui(new Ui::MainWindow)
    12. {
    13. ui->setupUi(this);
    14. }
    15.  
    16. MainWindow::~MainWindow()
    17. {
    18. delete ui;
    19. }
    20.  
    21. void MainWindow::on_pushButton_clicked()
    22. {
    23.  
    24. QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
    25. db.setDatabaseName("Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=d:/TEST");
    26. db.open();
    27. }
    To copy to clipboard, switch view to plain text mode 

    after pressing button I see the messages "

    QSqlDatabase: QODBC driver not loaded
    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7"

    How to solve the problem ?
    How to load the driver.

    I use Windows 7 64bit.

    Regards
    Artur

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QSqlDatabase: QODBC driver not loaded - problem

    Either install the plugin or build it from source (http://doc.qt.io/qt-5/sql-driver.html#qodbc). Depends how you got your Qt libraries

  3. #3

    Default Re: QSqlDatabase: QODBC driver not loaded - problem

    It is the description of installing plugin:

    How to Build the ODBC Plugin on Windows

    The ODBC header and include files should already be installed in the right directories. You just have to build the plugin as follows:

    cd %QTDIR%\qtbase\src\plugins\sqldrivers\odbc
    qmake odbc.pro
    nmake
    If you are not using a Microsoft compiler, replace nmake with make in the line above.

    Note: This database plugin is not officially supported for Windows CE.


    but I do not know where to find proper files

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QSqlDatabase: QODBC driver not loaded - problem

    In the Qt library source code.

    If you used the Qt Online Installer on Windows to get your Qt library then I would be very surprised if the QODBC plugin was not installed or easily installable.

  5. #5

    Default Re: QSqlDatabase: QODBC driver not loaded - problem

    Today I installed QT 5.6 once again (online instaler) and there is not QODBC plugin . I think there is a simple way to add the plugin but I do not know how to do it.

  6. #6

    Default Re: QSqlDatabase: QODBC driver not loaded - problem

    Nobody knows ?

Similar Threads

  1. Replies: 2
    Last Post: 13th October 2014, 18:35
  2. QSqlDatabase: QODBC driver not loaded
    By sattu in forum Qt Programming
    Replies: 1
    Last Post: 22nd January 2011, 11:40
  3. QSqlDatabase: QODBC driver not loaded
    By gutiory in forum Qt Programming
    Replies: 1
    Last Post: 14th April 2010, 09:24
  4. QODBC driver not loaded error
    By Askar in forum Qt Programming
    Replies: 0
    Last Post: 23rd October 2009, 10:35
  5. qodbc driver not loaded error in release mode
    By mandal in forum Qt Programming
    Replies: 1
    Last Post: 14th November 2006, 09:42

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.