The following forum(s) have migrated to Microsoft Q&A (Preview): Developing Universal Windows apps!
Visit Microsoft Q&A (Preview) to post new questions.

Learn More

 locked
[UWP][HTML]How to add a local Database in the UWP (Javascript) application RRS feed

  • Question

  • Hello,

    Is it possible to have a local database for a UWP (Javascript) application.?

    The local database is needed because my application will need to save the  data in offline mode(no internet connection)

    If possible Please guide me the way to do it.

    Regards,
    Ashwin



    • Edited by Ashwin Barfa Monday, December 3, 2018 9:07 AM
    • Edited by Barry Wang Thursday, December 13, 2018 7:03 AM title tag
    Monday, December 3, 2018 8:55 AM

All replies

  • Hi,

    SQLite is a light-weight local database for store and retrieve data on user device. Please take a look at this similar question here(https://social.msdn.microsoft.com/Forums/en-US/20639c1b-d0a5-421a-b89c-5c29a790696f/uwpwinjssqlite-database-in-windows-10-by-winjs?forum=wpdevelop). As mentioned in the marked answer, you can write a wrapper to access the SQLite using Windows Runtime Component, and call the component in JavaScript. Please refer to this article describes how to create a Simple Windows Runtime component and calling it from JavaScript. Even though the sample code in the post is outdated, I think it is helpful as a guidance.

    If you don’t want to write a wrapper for WinJS App, there is another workaround. You can create an AppService run as background task, which provides SQLite database access, and then call the app service in your javascript app. The AppService provider app is also deployed in the same device so that it could still working in offline mode.

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Proposed as answer by Azat Tazayan Tuesday, December 4, 2018 1:00 PM
    Tuesday, December 4, 2018 9:18 AM
  • @Ashwin,

    Any updates regarding this issue?

    Best regards,

    Barry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, December 26, 2018 9:23 AM