Qt World Summit: Register Today!

Pros & Cons of PostgreSQL and MySQL in Qt?

  • What would be the pros and cons of PostgreSQL and MySql with the QSqlDatabase class in Qt? Is there a preferred database when it comes to connecting remotely with C++? These are currently my only options, should I seek another?

  • From the perspective of writing application code there's not much difference. The binary releases of Qt for Windows don't come with either enabled but it's not difficult to enable either. Last time I looked on the Mac (this might be out of date, so verify yourself if it matters) PostgreSQL was already enabled but using an old libpq that doesn't work with the most recent PostgreSQL releases (the Qt code is fine, it just needs to be built with a more recent lib). I'd say you should evaluate which database is a better fit for your application and rest assured that Qt works fine with either. Depending on the nature of your application, you may also want to consider supporting both and let the user decide which they'd rather use.

  • Hi weblife,

    PostgreSQL supports a large part of the standard SQL and offers many modern features and it shares most of its capabilities with ORACLE, the world's most powerful data base system.
    For the security issue, remote connections are very secure with PostgreSQL. The server uses secure TCP connections with SSL encryption and provides a mechanism to prevent server spoofing attacks. Additionally, it provides several client authentications methods (password, md5 ...).
    I personally use PostgreSQL the UNIX data base system and it works very well with C/C++ applications (using libpq and Qt). Unlikely, I have read many posts, in this forum, concerning some problems of MySQL and Qt.
    PostgreSQL comes with its powerful C-libpq library which is used by Qt in its QtSql module to manage data bases.
    So, I think that PostgreSQL is your best choice :)
    this is a helpful tutorial : http://www.iissam.com/dbases/index.html

Log in to reply