PDA

View Full Version : QPSQL - Driver Not Loaded (WIN XP)



db
6th September 2009, 06:17
I built my QPSQL plugin. And it resides in same dir as the SQLITE and ODBC ones. In fact it is even in the Registry. However when I run my progem I get the error Driver Not Loaded and the following messages:

Starting E:/sdf/evtool/release/evtool.exe...
QSqlDatabase: QPSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QODBC3 QODBC

E:/sdf/evtool/release/evtool.exe exited with code 1

I have been through the forum and have not found anything that addresses this. They mainly concentrate on building the plugin.

I deleted the registry keys but that did not work

Any suggestions?

Thanks for the help

wysota
6th September 2009, 09:56
Are PostreSQL libraries in a path where the linker (loader) can find them?

db
6th September 2009, 14:16
Thanks for the quick response

Yes. I have both the include and the lib directories in the PATH. Do I need to set some other environment variable?

One other note. The code that I am running I originally opened SQLITE database and it worked OK. I just switched databases.

faldzip
6th September 2009, 15:32
as far as I remember there is also bin directory, with some needed dlls so try adding it also to PATH

db
6th September 2009, 20:16
That did not work either. I wonder if I need to recompile PostgreSQL using th MinGW that comes with Qt Creator 2009.01.

enzo
8th September 2009, 05:12
I had the same trouble before yestoday.:(
My friend gave me a suggestion to solved this trouble.:D
If your application's structure like this:
==========
/bin
/bin/myApp.exe
/plugins
/plugins/sqldrivers
==========
You can puts your driver into the "/plugins/sqldrivers" folder
and write code in "main.cpp" like this:
==========================
QApplication::addLibraryPath("plugins");
==========================
Another way to solve this trouble:
Use the "qt.conf" file
http://doc.trolltech.com/4.5/qt-conf.html
That all.Good Luck!

faldzip
8th September 2009, 07:46
I don't know how it looks with MinGW because I am using VS, but I solved such problem this way:
In directory where your exec is create directory named "sqldrivers". Put the qsqlpsql drivers there. Now use the dependency walker (http://www.dependencywalker.com/) to find out which dlls you have to put in your exec dir (taken from postgresql bin package). Put them in your exec dir, not sqldrivers, so dependency walker will not find them anyway in sqldrivers but it is okey. There were more than 10 dlls (I think so...) to copy.

db
11th September 2009, 13:35
Enzo

Thanks for you suggestion. I have tried that one and it does not work.

Faldzip

Also thanks. I tried something similar but I did not think about the DLLs being Postgresql's. I will give Dependency Walker a try.

You do point out what I think is part of the problem. I do not use VS. I prefer to use MinGW and QT because I switch my code between Win and Linux.

I though that there version of PostgreSQL was compiled with MinGW. I did try to recompile with latest MinGW but it has trouble doing CreateProcess. Still working that issue as well.

Sure wish that Nokia would supply the driver PostgreSQL as with SQLITE since it is an open system.

db
14th September 2009, 02:48
Well I solved my problems. I dropped PostgreSQL and went with MYSQL. I downloaded the server, gui tools, and workbench packages and installed them. Then I creates a simple database with the workbench tool.

Next I built the MYSQL plugin following the instructions. When I compiled and ran code it work first time!!! All this took 2.5 hours.... not bad compard to the days I have spent with PostgreSQL getting nowhere.

Thanks for all the help and suggestions