I am working on an ionic application, in which I need to perform some database operations. I already have an existing .db file.
But, as I am running on a browser (just for development purpose) where it couldn’t find cordova, also the path for db file is ‘default-path’ (android internal storage) and we cannot set absolute path.
So, is there any solution where I can access and operate db file on a browser (ionic serve) by doing some tweaks?
You cannot access sqlite in the browser. sqlite is only available on native devices.
Best trick or idea to try out is to use something like ionic storage
Which will normalize different storage mechanism.
You should also avoid using existing DB files too. Not very crossplatform way of handling storage
Thank you Mike for the quick response.
As I see the documentation of ionic-storage, it says that only works while running in a simulator or on device. In my case it is a browser.
I will still try though. Thanks for the pointers.
No, ionic-storage can work in the browser as well.
Ionic Storage can adapt different storage mechanisms that are available. So this could meaning using sqlite on device (if the plugin is installed) or using something like indexedDB (which is available everywhere).
Point being, you should be using a more adaptive storage approach and not depending solely on sqlite