QNetworkProxy::setApplicationProxy() breaks QSqlDatabase



  • Hi,

    I'm not sure if this is a problem with my understanding of Qt, or my understanding of the fundamental concept of network proxies.

    I have an application connecting to a server with a QTcpSocket, and connecting to the same server using QSqlDatabase.

    Recently I added in the option to connect through a proxy, and used the QNetworkProxy::setApplicationProxy() to direct all traffic through a Socks5 proxy. The QTcpSocket component works fine, but the QSqlDatabase does not.

    If I tell only the TCP Socket to go through the proxy, and the MySQL connection to go directly, all is well, but all traffic must go through the proxy.

    My question: Can I open a connection to a MySQL server, using QSqlDatabase, via a client-side proxy?

    Windows 7, Qt 5.3, MSVC2010

    Thanks


  • Lifetime Qt Champion

    Hi,

    Can you show a minimal code sample where you setup that ?



  • Hi SGaist, thank you for replying.

    I found that I can implement a proxy simply by connecting my QSqlDatabase to the proxy, and forwarding the proxy to the appropriate server with the database. This was a silly mistake on my part.

    However, I still think it's interesting that QNetworkProxy::setApplicationProxy() affects the SQL connection in such a strange way. I will try to find time over the next 24 hours to condense my code into a simple example.

    Cheers
    Joe


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.