Ways of accessing databases?



  • Since I did not found a way to succesfully build and load qmysql driver for android app, and webkit is not supported in android, are there any other ways of accessing sql databases?(MySql in particular).


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    The recommend way to access a database from such a device is the use of a web service. You don't want to have your MySQL server opened on the web.



  • [quote author="SGaist" date="1399405485"]The recommend way to access a database from such a device is the use of a web service. You don't want to have your MySQL server opened on the web.[/quote]

    +1 for a web service that acts as an API to access and manage the data at the database seems the best option in this case. Results returned like JSON or XML can be easily processed from the mobile app.



  • I've started on using network classes on retrieving data from a webserver, but can someone explain me why is it so risky to open a remote connection through mysql driver?

    I mean as novice a,for me, is a bit strange as I've seen several posts around forums that the best choice is a web server instead of direct connection, yet I didn't saw any explanations about it.

    Thank you.


  • Lifetime Qt Champion

    It basically boils down to that: would you like anyone to try getting access to all the data you have in your database ? Run any and every MySQL command against it ?

    Using a web service, you have a (hopefully) well defined API that only offers the operation what you want your user to have. What database system you use (MySQL, PostgreSQL, NoSQL, csv etc..) is hidden behind the service, so you can also change the backend without having to rewrite your application and deploy it again. Furthermore, this allows you to write client for platforms that don't have a native client.

    Rule of thumb is only use direct database access when you're in a controlled environment. Otherwise don't, security of your data is also at stake.



  • You got a point there, I thought about it but want it to make sure. Thank you for your explanation.


Log in to reply
 

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