..........
..........
Last edited by KeithN; 10th November 2011 at 03:26.
Everything working now. Thanks again.
Hi. I'm still fighting with this problem.
I downloaded those drivers (from the link) and put those into "E:\QtSDK\Desktop\Qt\4.7.4\mingw\plugins\sqldriver s" -directory. After that I put "C:\psql\9.1\bin;" into system variable PATH. After that I restarted Nokia Qt Creator and pressed run my project and the result was still: QSqlDatabase:
QPSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE
This is though. I have fought and fought with this problem and it's still beating me. So please, I need help. Thank you.
Wohoo!! I solved the problem. I had 64bit version of the postgreSQL and 32bit-version was the one I should have used. Changeing the psql version solved the problem.
So overall what I did to get the psql plugin work in my QtSDK:
1. I downloaded psql drivers from the previously mentioned link. (You can also create those by your self incase url is not available).
2. I added those driver files into "E:\QtSDK\Desktop\Qt\4.7.4\mingw\plugins\sqldr iver s" -directory.
3. I added "C:\psql\bin;" (and just to make it sure also "C:\psql\lib;C:\psql\include;") to my PATH system variable.
4. Finally started Qt creator and tested my code... ..and vóla!
Thank's everyone.
rivci (4th May 2012)
Good day everyone,
I still encounter trouble with the QSPQL driver.
Until the #13 post, everything worked fine.
I followed these steps according to:
http://www.qtcentre.org/wiki/index.p...s_using_MinGW;
-Go to %QTDIR%/src/plugins/sqldrivers/psql. (for me: D:\Qt\2010.05\qt\src\plugins\sqldrivers\psql)
-Run the following command: qmake -o Makefile "INCLUDEPATH+=C:\PostgreSQL\8.3\include" "LIBS+=C:\PostgreSQL\8.3\lib\libpq.a" psql.pro
NB:I wrote: "qmake -o Makefile "INCLUDEPATH+=D:\PostgreSQL\include" "LIBS+=D:\PostgreSQL\lib\libpq.a" psql.pro" in order to match the correct destination.
-Run make - this should build the qsqlpsql.dll and libqsqlpsql.a files in the %QTDIR%/plugins/sqldrivers directory. (where i ran :mingw32-make.)
at this point i got in %QTDIR%/src/plugins/sqldrivers/psql
I this point I noticed that I had no debug or release directory at all whereas it is the case in this discussion.Qt Code:
11/02/2012 15:46 <REP> . 11/02/2012 15:46 <REP> .. 26/05/2012 23:34 2*873 main.cpp 10/09/2010 10:05 514 psql.pro 10/09/2010 10:05 215 README 25/05/2012 19:09 781 qsqlpsqld_resource.rc 25/05/2012 19:09 <REP> tmp 25/05/2012 19:09 780 qsqlpsql_resource.rc 25/05/2012 19:09 24*845 Makefile.Debug 25/05/2012 19:09 24*693 Makefile.Release 25/05/2012 19:09 6*122 MakefileTo copy to clipboard, switch view to plain text mode
Meanwhile:
%QTDIR%/src/plugins/sqldrivers/psql>dir
At this point, i have a test program:Qt Code:
11/02/2012 15:47 <REP> . 11/02/2012 15:47 <REP> .. 13/09/2010 06:16 2*168 libqsqlite4.a 13/09/2010 06:16 2*178 libqsqlited4.a 13/09/2010 06:17 2*178 libqsqlodbc4.a 13/09/2010 06:17 2*182 libqsqlodbcd4.a 13/09/2010 06:17 478*720 qsqlite4.dll 11/02/2012 15:56 1*736*365 qsqlited4.dll 13/09/2010 06:17 163*840 qsqlodbc4.dll 13/09/2010 06:17 971*676 qsqlodbcd4.dll 27/05/2012 12:16 889*883 qsqlpsqld4.dll 27/05/2012 12:16 2*182 libqsqlpsqld4.a 27/05/2012 12:16 123*392 qsqlpsql4.dll 27/05/2012 12:16 2*178 libqsqlpsql4.aTo copy to clipboard, switch view to plain text mode
Qt Code:
#include<QApplication> #include<QtSql/QSqlDatabase> #include<QDebug> #include<QtGui> int main(int argc, char *argv[]) { return a.exec(); }To copy to clipboard, switch view to plain text mode
and a .pro like this:
QT+=sql
SOURCES += \
main.cpp
Still nothing is working ouput:
I'm not sure how to set correctly the right PAHT variable so i did like this inside the Qtenv.bat (or Qtvar.bat) name differs for a reason i ignore.Qt Code:
Démarrage de E:\cyril ***\Mes documents\Projets_Qt\test_connect_postgres1-build-desktop\debug\test_connect_postgres1.exe... QSqlDatabase: QPSQL driver not loaded ("QSQLITE", "QODBC3", "QODBC") E:\cyril ***\Mes documents\Projets_Qt\test_connect_postgres1-build-desktop\debug\test_connect_postgres1.exe s'est terminé avec le code 1To copy to clipboard, switch view to plain text mode
And i set the same inQt Code:
@echo off rem rem This file is generated rem echo Setting up a MinGW/Qt only environment... echo -- QTDIR set to D:\Qt\2010.05\qt echo -- PATH set to D:\Qt\2010.05\qt\bin echo -- MINGW set to D:\Qt\2010.05\qt\mingw echo -- lib set to D:\Qt\2010.05\qt\lib;D:\Qt\2010.05\mingw\lib echo -- include set to D:\Qt\2010.05\qt\include;D:\Qt\2010.05\mingw\include echo -- Adding D:\Qt\2010.05\bin to PATH echo -- Adding %SystemRoot%\System32 to PATH echo -- QMAKESPEC set to win32-g++ set QTDIR=D:\Qt\2010.05\qt set PATH=D:\Qt\2010.05\qt\bin set PATH=%PATH%;D:\Qt\2010.05\bin;D:\Qt\2010.05\mingw\bin set PATH=%PATH%;%SystemRoot%\System32 set PATH=%PATH%;D:\PostgreSQL\bin;D:\PostgreSQL\lib;D:\PostgreSQL\include set QMAKESPEC=win32-g+To copy to clipboard, switch view to plain text mode
Users environnement PATH variable,
System PATH environnemnet variable.
I would be very glad to anyone of you, who will be able to help me as i have been working on that for 3 days now, searching on various topics.
Best regards
Thanks!
Cyril.
My configuration is: Windows XP SP3, PostgreSQL 9.1 and Qt4.7 QtSDK 2010.05
Last edited by CyrilQt; 27th May 2012 at 15:19.
See the wiki article directly related to the Qt SDK: [wiki]Building the Database Plugins for QtSDK Users[/wiki].
The entire process on my machine:
- Download and install PostgreSQL using the one click Windows installer. I installed under "D:\PostgreSQL" giving me "D:\PostgreSQL\9.1\bin" etc.
- Change directory to the psql sql driver source directory and build:
Qt Code:
cd C:\QtSDK\QtSources\4.8.1\src\plugins\sqldrivers\psql qmake INCLUDEPATH+="d:/PostgreSQL/9.1/include" LIBS+="d:/PostgreSQL/9.1/lib/libpq.lib" mingw32-make mingw32-make installTo copy to clipboard, switch view to plain text mode- Compile and test your program in debug mode. The "D:\PostgreSQL\9.1\bin" directory needs to be in the user's PATH in order to use the plugin. The "...\lib" and "...\include" directories do not. I did that for testing purposes using the program run settings in Qt Creator.
The default steps only installed the debug model plugin. You will also want the Release mode plugin:
Qt Code:
qmake INCLUDEPATH+="d:\PostgreSQL\9.1\include" LIBS+="d:\PostgreSQL\9.1\lib\libpq.lib" CONFIG+=release mingw32-make mingw32-make installTo copy to clipboard, switch view to plain text mode
CyrilQt (28th May 2012)
Dear ChrisW67,
I downloaded and install Qt SDK from:
http://qt.nokia.com/downloads/sdk-windows-cpp-offline
in the D:\QtSDK directory
The path variable environnement checked with "Qt 4.8.1 Desktop (MinGW)" is set as followed
As declare in Path i have the postgresql like this: D:\PostgreSQLQt Code:
PATH=D:\QtSDK\mingw\bin;D:\QtSDK\Desktop\Qt\4.8.1\mingw\bin;C:\WINDOWS\system32;C:\WINDOWS; C:\WINDOWS\System32\Wbem;C:\Program Files\Intel\Wireless\Bin\; D:\PostgreSQL\include;D:\PostgreSQL\lib;D:\PostgreSQL\bin;To copy to clipboard, switch view to plain text mode
so i ran:
but showed:Qt Code:
D:\QtSDK\QtSources\4.8.1\src\plugins\sqldrivers\psql>qmake INCLUDEPATH +="D:/Pos tgreSQL/include" LIBS+="D:/PostgreSQL/lib/libpq.lib"To copy to clipboard, switch view to plain text mode
cannot find file INCLUDEPAHT
so i shifted to
then OK.Qt Code:
D:\QtSDK\QtSources\4.8.1\src\plugins\sqldrivers\psql>qmake "INCLUDEPATH +=D:/Pos tgreSQL/include" "LIBS+=D:/PostgreSQL/lib/libpq.lib"To copy to clipboard, switch view to plain text mode
then ran:
mingw32-make
console displays:
that looks good.Qt Code:
Creating library file:debug\libqsqlpsqld4.a mingw32-make[1]: leaving directory'D:\QtSDK\QtSources\4.8.1\src\plugins \sqldrivers\psql'To copy to clipboard, switch view to plain text mode
then i proceeded:
Qt Code:
D:\QtSDK\QtSources\4.8.1\src\plugins\sqldrivers\psql>mingw32-make install mingw32-make -f Makefile.Debug install mingw32-make[1]: Entering directory `D:/QtSDK/QtSources/4.8.1/src/plugins/sqldri vers/psql' copy /y "debug\qsqlpsqld4.dll" "d:\QtSDK\Desktop\Qt\4.8.1\mingw\plugins\sqldrive rs\qsqlpsqld4.dll" 1 fichier(s) copié(s). mingw32-make[1]: Leaving directory `D:/QtSDK/QtSources/4.8.1/src/plugins/sqldriv ers/psql' D:\QtSDK\QtSources\4.8.1\src\plugins\sqldrivers\psql>To copy to clipboard, switch view to plain text mode
I opened my testing code:
and it answered me:Qt Code:
#include<QApplication> #include<QtSql/QSqlDatabase> #include<QDebug> #include<QtGui> int main(int argc, char *argv[]) { return a.exec(); }To copy to clipboard, switch view to plain text mode
THANK YOU SO MUCH for helping me!!!Qt Code:
Démarrage de E:\cyril\Mes documents\Projets_Qt\test_connect_postgres1-build-desktop\debug\test_connect_postgres1.exe...("QSQLITE", "QODBC3", "QODBC", "QPSQL7", "QPSQL")To copy to clipboard, switch view to plain text mode
Best regards,
eternal gratitude.
Cyril.
The error message regarding INCLUDEPATH is because you inckluded a space between the INCLUDEPATH and the "+=..." so Windows was treating it as two arguments, which in turn lead qmake to look for a file called INCLUDEPATH.
Your quotes forced Windows to treat it as one argument and pass it to qmake as one argument. You could have left the space out, as in my example and the wiki page, with the same effect.Qt Code:
D:\QtSDK\QtSources\4.8.1\src\plugins\sqldrivers\psql>qmake INCLUDEPATH +=D:/PostgreSQL/include LIBS+=D:/PostgreSQL/lib/libpq.lib // ^^^ HereTo copy to clipboard, switch view to plain text mode
CyrilQt (17th June 2012)
Hello ChrisW67,
I am having troubles with Qt 5.1.1 when I try to build the plugin.
What I did:
- Added the directory C:\Program Files\PostgreSQL\9.3\bin with the C:\>set path=%path%;C:\Program Files\PostgreSQL\9.3\bin command.
- Tried C:\Qt\5.1.1\Src\qtbase\src\plugins\sqldrivers\psql >qmake INCLUDEPATH+="C:/Program Files/PostgreSQL/9.3/include" LIBS+="C:/Program Files/PostgreSQL/9.3/lib/libpq.lib" but I got the error below:
'qmake' is not recognized as an internal or external command, operable program or batch file.
- Searched where qmake is located and tried to execute the command above from there:
C:\Qt\5.1.1\mingw48_32\bin>qmake -makefile INCLUDEPATH+="C:/Program Files/PostgreSQL/9.3/include" LIBS+="C:/Program Files/PostgreSQL/9.3/lib/libpq.lib"
but instead I got answer how to use qmake:
Usage: qmake [mode] [options] [files]
QMake has two modes, one mode for generating project files based on
some heuristics, and the other for generating makefiles. Normally you
shouldn't need to specify a mode, as makefile generation is the default
mode for qmake, but you may use this to test qmake on an existing project
Mode:
-project Put qmake into project file generation mode
In this mode qmake interprets files as files to
be built,
defaults to *; *; *; *.ts; *.xlf; *.qrc
Note: The created .pro file probably will
need to be edited. For example add the QT variable to
specify what modules are required.
-makefile Put qmake into makefile generation mode (default)
In this mode qmake interprets files as project files to
be processed, if skipped qmake will try to find a project
file in your current working directory
<output omitted>
-Also tried to include the -makefile but the result is again how to use.
Could you please review this and advise?
Thanks in advance for your cooperation.
Best regards,
TerraxQt
Bookmarks