PDA

View Full Version : QODBC driver



hamidarr
19th July 2011, 10:31
hi everybody i write an application with qt 4.7 in windows 7 that connect to mssql 2008 on remote server .i need use this application on windows xp but when i execute exe file in windows xp it generate an error driver not loaded.in windows 7 i install sqlserver 2008 and create odbc connection and it run without error. i do'nt want in windiws xp setup qt sdk and sql server 2008.how can i run my program that can connect to mssql remote server?

mcosta
19th July 2011, 11:09
This is a "deployment" problem.

Read here and here for details

Aleksandar
19th July 2011, 23:41
When You compile and link your files using Qt Editor, Qt will create folder: C:\....\MyProject-build-desktop\debug
Inside this folder there will be MyProject.exe file.
You must copy into this folder some dll files.
You can find dll files here: c:\QtSDK\Desktop\Qt\4.7.3\mingw\bin\
Into debug folder You must copy 4 files that are needed by any Qt app. Those files are:
1. libgcc_s_dw2-1.dll
2. mingwm10.dll
3. QtGuid4.dll
4. QtCored4.dll

I'm not quite sure about next steps because I was doing this in earlier versions of Qt, but here is how I was doing it:
Copy this folder: c:\QtSDK\Desktop\Qt\4.7.3\mingw\plugins\sqldrivers \ into your debug folder(the folder that contains MyProject.exe file)
Just in case copy these dll files into your debug folder:
1. QtSqld4.dll
2. QtSql4.dll
(These two files location is c:\QtSDK\Desktop\Qt\4.7.3\mingw\bin\)

Edit your .pro file by adding this code: QT += core sql

Qt Code:


QT += core gui\
+= core sql //THIS IS WHAT YOU NEED TO ADD

TARGET = MyProject
TEMPLATE = app


SOURCES += main.cpp\
mainwindow.cpp \
.
.
.


Copy your debug folder to PC without installed Qt and run MyProject.exe file. If the problem persist after that notify me, and we shall see what to do next.

marcvanriet
21st July 2011, 01:09
As a side remark, I wouldn't use the debug build on a different machine.

Since the program starts on the other machine, I would think it has no problems with finding the QtGui and QtCore DLL's. Rather it may just be a matter of putting the plugins in the right place. You find the plugin DLLs to copy in your Qt directory \plugins\sqldrivers.

Best regards,
Marc