Sqlite plugin error after ionic update : openDatabase of undefined


#1

I get the following error on latest sqlite plugin in my ionic project.
0 281852 log Device is ready
1 281856 error Uncaught TypeError: Cannot call method ‘openDatabase’ of undefined, http://192.168.56.1:8100/js/app.js, Line: 35

I am trying to open db on device ready. Error is thrown in the following line in my app.js code
var db = window.sqlitePlugin.openDatabase(“myDatabase.db”, “1.0”, “Demo”, -1);

How ever I don’t get error when I replace the above code with :
var db = window.openDatabase(“myDatabase.db”, “1.0”, “Demo”, -1);

This used to work before I updated ionic. Not sure if this is ionic specific issue?


#2

Did you instal SQLCordova ?:slight_smile:
I’m using this command to open db: var db = $cordovaSQLite.openDB({ name: ‘name.db’, bgType: 1 });

And remember to check if device is ready :smile:


#3

Yes I installed cordova plugin.

Yes I tried that too but didn’t work. This code used to work previously before I updated ionic.


#4

Bugger!!! My mistake I added wrong plugin. There are quiet a few version of sqlite plugins to get confused :wink:


#5

please which plugin you download just send me details