QSqlDatabase: QODBC driver not loaded - problem
Hi
I have the following code :
Code:
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDebug>
#include <QSqlDatabase>
#include <QSqlQuery>
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_clicked()
{
db.setDatabaseName("Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=d:/TEST");
db.open();
}
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
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
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 :(
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.
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.
Re: QSqlDatabase: QODBC driver not loaded - problem