Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    QNetworkProxy::setApplicationProxy() breaks QSqlDatabase

    General and Desktop
    2
    3
    770
    Loading More Posts
    • 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.
    • J
      jtr-89 last edited by

      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

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

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

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 0
        • J
          jtr-89 last edited by

          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

          1 Reply Last reply Reply Quote 0
          • First post
            Last post