Deploy Ionic Framework App With Pre-Filled SQLite DB issue resolved


Refer this link first:

There is an issue while implementing pre-papulated database, existing database could not be open in this case.Because above link do not specify exact location where db file stored while copying.

So while you open database you have to mention its db location. Below is the filtered code:

window.plugins.sqlDB.copy(“populated.db”, function() {
db = $cordovaSQLite.openDB({name:“populated.db”,
}, function(error) {
console.error("There was an error copying the database: " + error);
db = $cordovaSQLite.openDB({name:“populated.db”,

Note: iosDatabaseLocation should be “Documents” because while copy db file, it automaticaly store file in documents folder.

In my case db file copy location was /Users/bayatreecomp/Library/Developer/CoreSimulator/Devices/EBEDC93E-21F4-4C90-BFA7-16F0593816F1/data/Containers/Data/Application/4C5A8E28-C326-4F17-9365-670EADF8DEF3/Documents

That’s why we specify “Documents” in iosDatabaseLocation.