1

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?

1
  • a browser is not a mobile device. for example, when in need to test things depending on plugins, i tend to check if we are in a real device or running on a browser. the nearest thing to sql that you will have on browser is websql, however it is deprecated: caniuse.com/#feat=sql-storage Commented Jan 21, 2018 at 21:24

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.