Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How do I make my Qt PostgreSQL driver for Mac support SSL?
Forum Update on Monday, May 27th 2025

How do I make my Qt PostgreSQL driver for Mac support SSL?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 3.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    someguy
    wrote on 31 Aug 2011, 16:52 last edited by
    #1

    Hi folks,

    I've been wondering how to make SSL connections work from my Qt application to a PostgreSQL database. I've already followed the steps listed here http://doc.qt.nokia.com/latest/sql-driver.html#qpsql to build my PSQL driver for Qt -> PostgreSQL (Qt 4.7.3, PostgreSQL 8.4.8), which works just fine for local and remote host connections.

    However, I'm having difficulty making an SSL connection to the PostgreSQL server (that is, a "hostssl" entry in Postgre's pg_hba.conf file). I've followed the directions at http://doc.qt.nokia.com/latest/qsqldatabase.html concerning the QSqlDatabase::setConnectOptions() function, and am adding the line:

    @db.setConnectOptions("requiressl=1");@
    

    before I open the connection. However, when I try this I receive "invalid connection option "requiressl"" from the db.lastError().text() after failing to open the connection.

    The impression I have at the moment is that I didn't properly build the Qt PostgreSQL driver with SSL support, but I'm not sure where to go from here.

    My ideas:

    1. Try re-building the Qt PostgreSQL driver with a different version of PostgreSQL in the hopes that it will then support SSL.
    2. Try re-building the Qt PostgreSQL driver after re-building Qt with SSL support from OpenSSL (not sure if this is necessary if I just want SSL support through the driver).

    Does anyone know what is more likely the issue? Or perhaps something else I haven't thought of?

    Thanks for reading, and I appreciate the help.

    Edit:

    Additional Info: I've also built the Qt PostgreQSL driver for Windows and do not have the same issue (Qt 4.7.3 built without OpenSSL, PostgreSQL 8.4.8), making me further believe it was just the Mac driver build that went wrong somehow.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      someguy
      wrote on 1 Sept 2011, 14:37 last edited by
      #2

      Issue was solved: Downloaded PostgreSQL 9.0 and re-built the Qt PostgreSQL driver with 9.0's headers and libraries. Now I can make SSL connections to PostgreSQL.

      1 Reply Last reply
      0

      2/2

      1 Sept 2011, 14:37

      • Login

      • Login or register to search.
      2 out of 2
      • First post
        2/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved