Reputation: 1138
I am creating a database for an application in ionic 2, and it fails where I create it:
this.sqlite.create({
name: 'details.db',
location: 'default'
}).then((db: SQLiteObject) => {
//... }
Error:
OPEN database: details.db
Error: exec proxy not found for :: SQLitePlugin :: close
Error: exec proxy not found for :: SQLitePlugin :: open
OPEN database: details.db FAILED, aborting any pending transactions
Error: Could not open database
at newSQLError (SQLitePlugin.js:25)
at SQLitePlugin.js:198
at Object.module.exports [as exec] (cordova.js:1006)
at SQLitePlugin.js:207
at Object.module.exports [as exec] (cordova.js:1006)
at SQLitePlugin.open (SQLitePlugin.js:210)
at new SQLitePlugin (SQLitePlugin.js:84)
at Object.<anonymous> (SQLitePlugin.js:600)
at Object.openDatabase (SQLitePlugin.js:58)
at index.js:176
I have added the Cordova functionalities via ionic cordova platform add browser
.
I run the app liko so:
ionic cordova run browser
Does it mean that this cordova functionality(create database) is not available in a browser?
Upvotes: 1
Views: 5490
Reputation: 134
You cannot open database via Cordova Web Browser. What you can do is use the Emulator for Android provided by Visual Studio.
This way the database will be accessible.
Upvotes: 2
Reputation: 1661
It seems that you'll have to use a mock to be able to use browser environment with SQlite. I will try this, too: https://medium.com/@tintin301/ionic-sqlite-storage-setting-up-for-browser-development-and-testing-67c0f17fc7af
Some people warned about this so I would recommend this other approach: https://forum.ionicframework.com/t/ionic-native-sqlite-issue/87416/18
Upvotes: 1