简体   繁体   中英

How to enable SSL with Qt QODBC

I can't find information about this. Is it possible to enable SSL with QODBC? If so, how?

I have no issues using SSL with QMySql or using non-SSL connection with QODBC. However, the QODBC driver documentation at http://qt-project.org/doc/qt-5.1/qtsql/sql-driver.html#qodbc makes no mention of SSL + ODBC and QODBC rejects parameters not on the list at http://qt-project.org/doc/qt-5.1/qtsql/qsqldatabase.html#setConnectOptions , none of which pertain to SSL.

Interestingly enough, I cannot find documentation for those options, their meanings, or their allowed values anywhere. The only mention of those options I can find at all is on that documentation page, which does not state whether it is a comprehensive list or provide any further information.

The only other direct reference I can find to using SSL with QODBC is an unanswered post from four years ago: http://www.qtcentre.org/threads/34367-SSL-with-QODBC

Finding this information is further compounded by the fact that QODBC is also the name of an apparently unrelated ODBC product for Quickbooks.

This is a copy of my post at http://qt-project.org/forums/viewthread/36850/

You need to pass your secure connection options as part of ODBC datasource to QSqlDatabase::setDatabaseName . ODBC datasource should look similar to:

Driver={MySQL ODBC 5.1 Driver};Server=server_address;Database=database;
User=username;Password=password;
sslca=ca.crt;sslcert=client.crt;sslkey=client.key;sslverify=1;

I haven't checked this exact string, just show the idea (taken from here ). See MySQL Connector/ODBC documentation for details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM