QT Open Source and Databases
-
Does QT limit what databases can be used with the open source version of QT. On my computer, I have MySQL, PostgreSQL, SQL Server, and ... cough, cough, ... MS Access. So far, I've been unable to build a driver for MySQL and PostgreSQL. For PostgreSQL everything I try gets me the error
Cannot read C:/qtsqldrivers-config.pri: No such file or directory
Cannot read /mkspecs/modules-inst/qt_plugin_qsqlpsql.pri: No such file or directoryI got that when I tried qmake on the psql.pro file.
So far, it seems like the only database I can connect an application to is SQLITE, which as I understand, is not really a database.
-
@Eric_Lund said in QT Open Source and Databases:
Does QT limit what databases can be used with the open source version of QT.
Qt does not impose a limit. However, the database drivers have different licenses compared to open-source Qt's (L)GPL, which is why the Qt Project doesn't ship them by default and users have the build the drivers themselves.
So far, I've been unable to build a driver for MySQL and PostgreSQL. For PostgreSQL everything I try gets me the error
Cannot read C:/qtsqldrivers-config.pri: No such file or directory
Cannot read /mkspecs/modules-inst/qt_plugin_qsqlpsql.pri: No such file or directoryI got that when I tried qmake on the psql.pro file.
Please describe in more detail:
- How and where you installed the PostgreSQL headers and libraries
- How you got the Qt source code
- How you ran qmake
There are some instructions at https://doc.qt.io/qt-5/sql-driver.html#how-to-build-the-qpsql-plugin-on-windows
So far, it seems like the only database I can connect an application to is SQLITE, which as I understand, is not really a database.
SQLite is not a client-server database, but it's certainly an ACID-compliant database.
-
Please describe in more detail:
How and where you installed the PostgreSQL headers and libraries
Windows installer on x64 (I'm on build 10.0.19041.0)
C:\tools\PostgreSQL\13 include and lib dirsHow you got the Qt source code
Full install from the QT website to: C:\tools\Qt\5.15.1\Src ... thence ... qtbase\src\plugins\sqldriversI'm using C:\Program Files (x86)\Microsoft Visual Studio\2019\Community \VC\Tools\MSVC\14.27.29110\bin\Hostx64\x64 as my compiler platform.
How you ran qmake
I got tired of errors at the command line, so I loaded the project to QtCreator, and ran qmake. That generated the error I posted.I was able to get a Makefile on the command line, but I was having a lot of difficulty getting all the paths correct so nmake could build.
I suspect that I need a few more items in environment variables before everything will build. I'm probably just getting frustrated. Started down this path because I got thrown into a project at work where we are converting our AIX (a UNIX) applications to Linux, and using QT for the UIs (Previously done in BxPro (Ick). I figure the more I used this at home, the less I'll struggle with it at work. Never had this much trouble configuring a database before to work with an application.
-
@Eric_Lund said in QT Open Source and Databases:
How you ran qmake
Please follow the instructions in the link @JKSH gave you. It will not work from QtCreator.
-
OK, started doing the stuff on that link, and got this error:
PS C:\tools\Qt\5.15.1\Src\qtbase\src\plugins\sqldrivers> qmake -- PSQL_INCDIR=C:\tools\PostgreSQL\13\include PSQL_LIBDIR=C:\tools\PostgreSQL\13\lib qmake : Project ERROR: You cannot configure sqldrivers separately within a top-level build. At line:1 char:1 + qmake -- PSQL_INCDIR=C:\tools\PostgreSQL\13\include PSQL_LIBDIR=C:\to ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (Project ERROR: ...op-level build.:String) [], RemoteException + FullyQualifiedErrorId : NativeCommandError
Working on figuring out what that means...
Thanks,
Eric -
@Eric_Lund said in QT Open Source and Databases:
Working on figuring out what that means...
You cannot configure sqldrivers separately within a top-level build.
Isn't this clear? You did not use an empty qt source tree.
-
That's what I figured. I also saw something that says I need perl, and possibly python to initialize a newly downloaded source code. Got Perl installed. The various chores happened, and now I'm going to download and install python. Then I'll download the source for QT. Good thing I recently replaced my nearly full 500GB ssd drive with a 2TB model. Lots of room.
As a windows user (ie, not developer), I never really understood the complaints. What a pita. The cntl-C --> cntl V repetition is nuts. I seem to remember Bill Gates saying that was one of the things he truly regretted. That and having to completely learn a different command line. At least power shell recognizes ls. 😁
find . -name windows.h becomes
Get-ChildItem -Path C:\ -Include windows.h -Recurse -ErrorAction SilentlyContinue
It's insane! -
You neither need perl nor python to compile the sql plugins. Please follow the docs!