Common database in web and mobile app

Common database in web and mobile app

  

Does anyone have an example of using a common database in both a web app and a mobile app? I need to know how to have a web app (or mobile app) update the server database so the updated data is available to the mobile app (or web app).

It's just a question of refreshing data when you feel it's required.  When I walked through the OS Tutorial for creating a Web and Mobile app I used my own MySQL database via an External Connection.  Both applications consuming and updating the same MySQL tables.

Hi Jae

If you search for "Directory" in the Forge, you'll find 3 components: EmployeeServices(a shared component that implements core Employee data model and logic services), DirectoryMobile (that consumes EmployeeServices) and DirectoryWeb (that consumes EmployeeServices as well).

So, basically, you have two apps, mobile and web, that connects to the same DB (EmployeeServices) - you can install them on your server and check how the logic is implemented. 

(Note: DirectoryMobile also works offline, as it loads all contacts and synchronizes changes when connected).


Hope that helps :)

Vera


Solution

Hello Jae,

Just to add some explanation to what was already told.

You can share many things between mobile and web applications. The limitation is User Interfaces, as both are worked differently under the hood.

But not visual elements, like server side Entities, can be made Public and shared with any module (web or mobile).
This way, you can have your entities being updated through the wewb application and you can use them directly in your mobile.

Usually the entities are in their own modules (and even own applications), for the sake of architecture, like in the example Vera showed.

Cheers.

Solution

Thanks all. I got it to work and it was very simple. Thanks again for pointing me in the right direction.

Eduardo Jauch wrote:

Hello Jae,

Just to add some explanation to what was already told.

You can share many things between mobile and web applications. The limitation is User Interfaces, as both are worked differently under the hood.

But not visual elements, like server side Entities, can be made Public and shared with any module (web or mobile).
This way, you can have your entities being updated through the wewb application and you can use them directly in your mobile.

Usually the entities are in their own modules (and even own applications), for the sake of architecture, like in the example Vera showed.

Cheers.

Hii Eduardo,
Vera suggested to use db as shared component service, but my question is  can I access my web app's  entity in mobile app. Like i have 2 custom entities for web app, now i have made mobile app for same thing.
So is it possible to use the same db ?    Considering i have initially not designed db as shared component service ?


Hi Anand,

The answer is yes. Basically, everything "server side", like entities and server actions, that can be shared, can be used in Mobile.

:)