How to use Sqlite in browser chrome with ionic serve?


Please, help me for solve this error:

Error: Uncaught (in promise): TypeError: Cannot read property ‘executeSql’ of null


How did you get sqlite into you app?

In general SQLite is a native plugin, that is only usable on the supported platforms. So this depends on how you got SQLite into your app.


i’m followed in this tutorial:

in my platform running well. but I try running in browser chrome, get that error.


This example uses Ionic Native and a Cordova plugin:

This only works on native devices:

Same here:

So, to test that you have to do it on devices, not in ionic serve.

1 Like

This is why I keep suggesting people use ionic-storage instead of trying to directly interact with SQLite. BTW, I would recommend anybody coming across this thread steer way clear of that “TeamClouders” demo. The code quality is terrible and it doesn’t make use of ionic-native.

1 Like

Ok, thanks for the answer :slightly_smiling_face: :+1:


Is there a storage limit if using it?


Not inherent to ionic-storage itself, as it is merely a layer on top of various driver backends. Out of the box, it will use IndexedDB in browsers, and SQLite on devices if the relevant Cordova plugin is installed. Any limitations would be imposed by the driver in use.

1 Like

Ok, i understand now. Thanks for the answer. very useful…:slightly_smiling_face::+1:


(sorry for the bump)

You recommend ionic-storage and that sounds fair and everything but it seems like it only saves key-value pairs. What if you need a table structure for dynamic data (for example blog posts, there could be one, there could be a hundred) where you add new rows whenever new data is created etc etc. How would you solve that with ionic-storage?
I can’t think of a way to simulate a table structure in key-value pairs except for saving the entire table in JSON string and throwing it in there as the value but that means for each edit you need to pull the entire string, filter through it, make changes and put it back. Doesn’t sound like good practice.


Then I totally agree with you that SQLite is the way to go. The thing is that while probably 80-90% of apps can get by just fine with a key/value store, people tend not to start there.


Useful post for the newbies. I found it quite helpful to make my decision on which to use.