- Home /
How to connect a mobile app to an online database?
Hi, I am developing an app which requires the use of online databases, one will include login information and the other will contain data which will contain data for the app.
The first database will obviously send data to the database when someone signs up and it will request data when someone logs in.
The second database will require the app to send data to be used in queries on the database to find relevant information for the user which will then be sent back to the app.
I have never attempted any networking of any kind before so for me this is quite daunting so if anyone could shed some light on how I would achieve this I would be most appreciative.
I also haven't set up an online database before so if someone could help me with setting that up as well that would be great, thanks!
know this is for unity only but in addition to the app, I want to make a website which will need to interact with these databases in the exact same manner, so if at all possible could someone help me with this as well
Answer by DiegoSLTS · Aug 21, 2016 at 06:22 PM
From Unity's side you only need to use the UnityWebRequest class (or WWW if you're using an older version of Unity).
For the database... you shouldn't just put the database online, you must write a webservice that access the database, and from Unity you do http requests to the webservice. This means writing some server logic in the language and framework of your choice. There are a lot of options for this and it's something totally independant to actual Unity development, so I won't name alternatives, do some research on webservices and you'll find a lot of good info.
Your web service logic will also be accessed from your website later, you'll probably write the page in the same language and framework used for the webservice.
Also, writing a web service is just that, writing, you'll also need to host the service and the database somewhere accesible from the internet. It can be a machine owned by you, that you setup to be accesible through internet or you use a free or paid hosting service for that.
Thankyou, I got the general concepts of how this stuff worked but this has really filled the blanks in that confused me. Thanks for a quick response as well!
Answer by wsgb · Aug 22, 2016 at 05:08 AM
You can also use a service for this such as https://playfab.com/ which would be easiest for you in my opinion.
Otherwise you can learn a web framework (like Rails or NodeJS, .NET, ect) and setup what @DiegoSLTS mentioned or something similar.
Check this out also https://www.youtube.com/watchv=EByl95OMG2o∈dex=1&list=PLTm4FjoXO7ndjPE8JXrJ9MjMfsJv956Qm