How do I open a database already created?


#1

Hello I have a database in SQLite and would like to know how do I do for my application to use it locally?

Currently I am using the following command to create the database:

db = $cordovaSQLite.openDB({name: “mydatabase.db”, iosDatabaseLocation: ‘default’});

My ready database stays in this project folder:

ApplicationName/www/database/mydatabase.db

Thank you!


#2

db.transaction(function (tx) {
//tx.executeSql(‘DROP TABLE IF EXISTS DATABASENAME’); // for deleting all records table
tx.executeSql(‘CREATE TABLE IF NOT EXISTS DATABASENAME(“value Type,value Type”)’); //for creating table
}
just check it