Forum Cross Platform with Xamarin
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Database type for mobile and web access

Which type of online database should i use to, at same time, being able to read/write into it from my app with a webservice, and make a web administration interface allowing to add content (and update what's displayed in app).



  • On the Web I use MS SQL Server, on mobile SQLite.

  • Greg_ruGreg_ru Member ✭✭

    But i need just one online database, and access to it from webservice and web.
    I guess you use Sqlite for local db?

  • JamesLaveryJamesLavery GBBeta, University ✭✭✭✭✭
    Given that you are accessing the database via a Web service, the choice really comes down to your experience and skills with server databases, and the cost involved.

    We use SQL Server.

    Yes SQLite is usually the DB of choice on the device.

    There are of course other options like nosql DBs, e.g. MongoDB. I don't have experience of these but I'm sure others can contribute.
  • Greg_ruGreg_ru Member ✭✭

    Well i know all sql requests pretty well, and made an app long time ago using wcf services.
    But i had a sqlite database on my remote server.

    I guess now i need to do the same, having a wcf service in my app, make it communicate with my remote iis server, which will communicate with sql server locally installed (instead of sqlite file as before) ?
    And then to make the admin interface (accessible from a web browser) i will also make requests (jquery?) on this SQL Server and link all this to some html/php page.

    But i can be wrong on some points, sorry for maybe basical questions, just coming back to app development after a while..

  • JamesLaveryJamesLavery GBBeta, University ✭✭✭✭✭

    I may be misunderstanding your description, but I think you may have the service/client the wrong way.

    The way this should be done is:

    SQL Server runs on a Windows server.

    A WCF service running on either the same server or another server (which can see the SQL Server) provides endpoints to clients. These endpoints access the SQL Server to retrieve data from and update the database.

    A WCF client runs on your device in your Xamarin app. This client talks to the WCF service.

    With the above implementation, if you always have a network connection between the device and the WCF service, you do not need a local database on the device.

    However, in order to cater for scenarios when there is no network connection (or to cache data locally), you should use SQLite on the device to provide local storage.

    As you say, you can/should provide an admin interface for your database which can be done with a web application (but again, for consistency, this should access the database via the WCF service).

    In the above, I have assumed a WCF service, but you can substitute almost any web service technology of your choice.

  • Greg_ruGreg_ru Member ✭✭

    Ok thanks for refreshing my memory, i almost forgot the distinct concept of wcf client / server.
    If i got it right it is:
    App making a request with WCF Client to WCF Server on my remote server (accessed with IIS). This WCF Server connects locally to SQL Server and write/read in the database. Then the data is taking the same reversed way back to be displayed in the app.

    For the local storage i planned to use akavache as someone advised me here, the data will be kinda light (few texts, settings, pictures). If i haven't misunderstood i can store all this with akavache.

    I guess this sample can also help me well:

    Ps: my english level is same as coding, so thanks for understanding :#

  • JamesLaveryJamesLavery GBBeta, University ✭✭✭✭✭

    Yes that sounds right!

    Akavache is good for storing settings and cacheing data - so that's a good choice. It uses SQLite underneath, by the way. I have not used Akavache but I think it's based on key-value object storage so is good for cacheing etc. - but if you end up wanting to store more data locally you should probably move to using SQLite itself.

  • Greg_ruGreg_ru Member ✭✭

    Cool so i'm on the right way!
    I haven't understood deeply how akavache works, but yeah at least i got the idea of key-value object storage, and it should do the trick for my needs.
    Thanks for your explanations!

Sign In or Register to comment.