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. QNetworkProxy::setApplicationProxy() breaks QSqlDatabase
QtWS25 Last Chance

QNetworkProxy::setApplicationProxy() breaks QSqlDatabase

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 979 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.
  • J Offline
    J Offline
    jtr-89
    wrote on last edited by
    #1

    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
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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
      0
      • J Offline
        J Offline
        jtr-89
        wrote on last edited by
        #3

        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
        0

        • Login

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