Solved QODBC driver not loaded
-
Is there someone that saw this message ?
QSqlDatabase: QODBC driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7for QODBC ?
Windows 10, 64 bits
PostgreSQL 9.5 using PostgreSQL ODBC Driver (UNICODE) -
You must create sqldrivers folder in your run directory and copy the qt sqldriver inside
-
So simple ?......really ?
-
I tried, but it did not work........I'm doing something wrong !
-
The driver is psqlodbc.dll also must have created the system DSN pointing to the database
I used this code to connect:
QSqlDatabase db = QSqlDatabase::addDatabase("QODBC", "InternalName" (or nothing if use only one db));
db.setDatabaseName("DbName" (System DSN ODBC Name));
db.setUserName("User");
db.setPassword("Password");
db.setHostName("Host"); -
@CadNeto
The odbc driver is not included in Qt 5.6 (https://bugreports.qt.io/browse/QTBUG-49420). You have to built it by your own (http://doc.qt.io/qt-5.6/sql-driver.html#qodbc-for-open-database-connectivity-odbc). -
Ok, I have to built it.
And the way is to use the commands:cd C:/Qt/5.6/Src/qtbase/src/plugins/sqldrivers/odbc
qmake odbc.pro
nmake
nmake release
nmake install
nmake release-installPlease, how is the right way to use the "nmake". In my case, nmake is not recognized.
thank you. -
@CadNeto said:
nmake
This is the visual studio make tool.
Do you have VS installed?
Qt can use different compilers. Normally its mingw or visual studio 201X
on windows.
These instructions seems to be for VS
for mingw compiler
nmake would be Mingw32-make
mine is located at
D:\Qt\Tools\mingw492_32\bin\mingw32-make.exe -
rss.......it works.
A right tip make a certain job.....rss
Thank you!