How do I make my Qt PostgreSQL driver for Mac support SSL?
-
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:
- Try re-building the Qt PostgreSQL driver with a different version of PostgreSQL in the hopes that it will then support SSL.
- 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.