简体   繁体   中英

qt4 not loaded odbc drivers

I created new application with QtSDK (latest available version) and this programs use odbc for database connection, but when I try add database I got error:

QSqlDatabase: QODBC driver not loaded
QSqlDatabase: available drivers: QSQLITE

When I do:

QStringList driversList = QSqlDatabase::drivers();
qDebug() << "drivers list= " << driversList;

I says that I have only qsqlite in list. After first time get this error, I remembered that on this computer I didn't build odbc plugin, so I went to plugins and did "qmake; name". After that I got qsqlodbc4.dll and "qsqlodbc.intermediate.manifest"

So it was a surprise when I created "sqldrivers" folder in same folder as .exe, copied these 2 odbc files there and still got same error. Program created with QtCreator and have same drivers list (qsqlite) when run from there and directly exe. Anyone can sugest where to look next?

When I look at process list I can see that this program runs as 32bit ("program.exe *32"). And windows is 64, maybe there's some issue with loading?

我不熟悉odbc,但是当忘记显示到Qt lib_mysql.lib时,我有与mysql有关的问题

Uninstalled all QtSDK, installed again only 4.7.4 version with MS Visual Studio 2005 (source and desktop). Build sql drivers and now they work. My ques would be that when I compiled first time, there was few different version and drivers was build bad (somehow), therefore they did not load.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM