Share database between app and web

2019-07-11 17:23发布

问题:

I'm involved into an app that have to retrieve queries from an existing database. This db have to be implemented in php in a remote server, and will be the place where the admin will have to insert content into the shared db, but I don't know how to implement that correctly or what is the best solution.

I'm thinking about make a sqlite database with php and connect directly the app to the db, but I haven't found yet the best way to do that.

What do you think? Thank guys.

回答1:

FYI, without any server communication (Web services) you can't use the website database in android application.

If you want to manage the communication between the website and the android app means you need a centralized server (probably my sql dab) which having the data of your web/mobile applications. So, after that by using the web service methods (REST/SOAP) you can achieve the communication between them

I'm thinking about make a sqlite database with php and connect directly the app to the db, but I haven't found yet the best way to do that.

This is not the right approach to connect mobile applications with the database. Instead you should create a middleware(REST/SOAP webservice) which runs on server. This middleware will in turn connect with the database and your mobile app whether it is android, iOS or windows app can communicate with this middleware.