Android Qt widgets and MySQL



  • 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


  • Lifetime Qt Champion

    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


Log in to reply
 

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