Error message (ODBC) "Driver not loaded" after upgrade from Qt 4.6.1 to 4.7.3
-
How to check it ?
I thought I did it with the
@
QString s( QSqlDatabase::drivers().join( "." )) ;
@line...
-
Well, you could just look at what drivers you have.
They should be in your Qt "root" under plugins/sqldrivers. -
Thanks. There are only qsqllite* files. What a pitty :)
Sorry for the simple questions, but: Where are the others? How to build or install them?
-
Check the "documentation":http://developer.qt.nokia.com/doc/qt-4.7/sql-driver.html#id-9b35bbe5-e3f8-4d40-b01a-08db65bd5f40 here.
-
Googeled a little bit and found this
http://doc.qt.nokia.com/latest/sql-driver.html
section "QODBC for Open Database Connectivity (ODBC)"
After the qmake command all works fine.
Thanks for help, Andre.
Regards
o2t2
-
Oh, one's more, Andre:
Neither in the %QTDIR%\plugins\sqldrivers directory nor in the src\plugins\sqldrivers\odbc directory there are no odbc driver dlls or libs.
Where they are ? (Searching in windows explorer does not bring a result...)
Why does it work now ?Background: The drivers have also to be installed at customer site...
-
They should appear in QTDIR\plugins\sqldrivers. If they do not, then something wend wrong with building them, I think.
If you install them at your customers site, I would recommend you do not install Qt as a shared library, at least not if Windows is your target platform (most likely when using ODBC). Instead, put Qt libs in the same directory as the executable, and the plugins you need in folders with the names corresponding to what you find inside QTDIR\plugins (that is: ommit the plugins\ directory level itself). That way, your app will find the right Qt libraries, and Qt will find its plugins without you having to do anything else.
-
Andre,
the "plugins\sqldrivers" directory do not have any odbc files. Crazy.
But i looked once more into the command window where I called qmake and nmake and I see, that nmake failed because the nmake command was not found on the system. May this be the cause for missing odbc dll in "plugins\sqldrivers" ?
If yes: Where resides the nmake? Again: Searching in windows explorer does not bring a result… -
Are you using MSVC or MinGW? If you are using the latter you have to use mingw32-make instead of nmake. If you are using the former, please use the MSVC Command Prompt, that automatically configures the paths to all the necessary tools.
-
I'm using MSVC. Your tip with the MSVC Command Prompt was the key to success.
Now I have the drivers in the plugins/sqldrivers directory.
Thanks once more, Andre.
Regards
o2t2
-
Next question related to this thread: The genration of the driver succeeded and they work fine inside the development environment (Win XP, MSVC2008).
Copied the generated exe and dlls to the runtime environment (MS 2008 Server R2), installed the data source (ODBC) as well as in the development environment.The same error message “Driver not loaded" occurs. So I copied the qsqlodbc.dll too. Same error message. What's wrong ?
Regards
o2t2
-
I am not able to connect any database successfully.Why this kind of problem generally occurs for a standardize software like QT.
-
@
QString ipserver,LoginName,database,Pass;
QSqlDatabase db = QSqlDatabase::addDatabase("QODBC", "MyDatabase");db.setDatabaseName("DRIVER={SQL Server};Server="+ipserver+";Database="+database+";Uid="+LoginName+";Port=1433;Pwd="+Pass+";WSID=");
if(db.open())
{
qDebug() << "Opened";
db.close();
}
else
qDebug() << "Error" << db.lastError().text();
@
the WSID =. “is used to hide the client machine to the database server log ,is optional .