Qt Forum

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

    Call for Presentations - Qt World Summit

    Android Qt widgets and MySQL

    Mobile and Embedded
    2
    2
    701
    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.
    • S
      scarja last edited by

      Hi,
      I'm new, hence maybe obvious questions. I've been through the whole get started with qt widgets programming and get the general basics. Now I have a SQL server running on my local linux machine, this sql server is already accessed by a PHP website. I would like to access the same database from a mobile app for android created by Qt widgets. Is there a way and can you point me to some documentation to connect to the db directly? Or (maybe best alternative) is there a way to call web APIs and send (maybe using POST methods) JSON data and read JSON responses? In the second case I could easily create some php functions to do what I want to do on the database and respond in JSON. I looked for documentation in the examples but didn't find anything, only stuff on using local device sqlite databases.

      Thanks,
      James

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

        Hi and welcome to devnet,

        Your second choice is the good one. Exposing a database to the world to be able to connect to it directly from your phone/tablet is a indeed a bad idea.

        For the json part you have the QJsonXXX classes, for the networking part you have QNetworkAccessManager. Depending on your needs and if my memory serves well, the Qxt library has already classes implementing what you need.

        Hope it helps

        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
        • First post
          Last post