Ionic 3 prepopulated database always create new db, it is unable to find from project directory in device

#1

private options = { name: “student.db3”, location: ‘default’, createFromLocation: 1 };

  this.sqlite.create(this.options).then((db: SQLiteObject) => {
   db.executeSql("SELECT * FROM tbl_student where studentId=?", [1]).then((data) => {
      if (data.rows.length > 0) {
         this.studentList = [];
         for (var i = 0; i < data.rows.length; i++) {
          this.villageList.push({
            'valueInteger': data.rows.item(i).studentId,
            'text': data.rows.item(i).studentName

          })
        }
      }
    }, error => {
      alert(JSON.stringify(error));
    })
  });

~ no such table:tbl_student,‘code’:5
~Plugin used is cordova-sqlite-ext 3.0.0 “Cordova sqlite storage plugin with extra features”

Need every one support to access the prepopulated database in ionic 3.
Thanks

#2

I could able to solve the problem.

Cordova SQLite Storage doesn’t use your app’s www folder to store data. Therefore we need to copy the pre-populated database from www folder to default location of sqlite. The following way

(<any>window).plugins.sqlDB.remove(db.db3’, 0, function (res) {

}, (error: any) => { });

(<any>window).plugins.sqlDB.copy(‘db.db3’, 0, function (res) {

}, (error: any) => { });

Might be helpful for other.
More details please check https://github.com/an-rahulpandey/cordova-plugin-dbcopy