I created the initial slide menu application using ionic.
I've a db file in my project, How can i access this.
I want to access the existing data base in my project and populate the data in my app.
I tried below plugins and other tutorials but I can't able to access the data base file.
https://github.com/litehelpers/cordova-sqlite-ext
Anyone can you please help and suggest me something in this. Thanks.
To prepopulate your database you can do this :
Run these commands:
git clone https://github.com/nolanlawson/cordova-prepopulated-database-demo.git
cd cordova-prepopulated-database-demo
cordova plugin add cordova-plugin-file
cordova plugin add cordova-plugin-sqlite-2
Then to run on iOS:
cordova platform add ios
cordova run ios
Or to run on Android:
cordova platform add android
cordova run android
You have now a file called mydatabase.db in www/. This is a simple database, with the following structure:
>.schema
CREATE TABLE mytable (foo text, bar text);
>SELECT * FROM mytable;
hello|world
You just have to edit this file to populate the database as you wish !
More information on this github : https://github.com/nolanlawson/cordova-prepopulated-database-demo
Hope it will help you ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With