- You run your app in debug mode, and when it hits the instruction QSqlDatabase::addDatabase('PSQL') it displays a message like "plugin not loaded" and shows a list of available plugins. If PSQL is not on the list, it means the plugin hasn't been compiled, so it's not available. There is plenty of information on how to compile the plugin, make sure you compile for debug and release. I'll add some urls in comments later on how I did it. To make it a bit easier, do not install PostgreSQL on "c:\program files...", the spaces may give troubles when running the make file. Install in something like "c:\psql" instead.
- Same problem as (1), but this time, it shows PSQL on the list of available plugins. The plugin is missing some PostgreSQL dll's. In debug mode, add the PSQL/bin and PSQL/lib to the proyect's buil environment path. For release mode, you have to copy all but the wx... dll files in the PSQL/bin directory to the same directory as the executable.
- Everything works in the development computer, but the plugin is not loaded if you move the executable the another qt free computer. This one was a bit tricky for me. Use QLibraryInfo::location(QLibraryInfo::PluginsPath) to discover in which directory your app is searching for the plugins. In my case, it was searching on the qt installation directory and the application directory ( the directory where the .exe file is located). So, I created a directory "sqldrivers" in the same directory as my .exe, and there I added the PostgreSQL dll.
Hope I made myself clear and it helps you with Qt.
1 comentario:
UPDATE: I still had some issues when distributing my application. PostgreSQL windows binary seems to be built with MS Visual C++ 2008, so in order to fully deploy the app, you also need to install msvc runtime 2008 redistributables on the destination computers. It seems this only affects XP, there are no troubles with Win7
Publicar un comentario