How to check if SQLite actually being used for Storage

I am not convinced I know what “storage” method is being used at any given moment. I have installed cordova-sqlite-storage and ionic storage as per the documentation. But when I access “storage.driver” on an iOS device, it comes up blank. On chrome (on a Mac) it initially comes up as “asyncStorage” - I was kinda expecting “IndexDB” or “WebSQL”. I am also getting different data read at different times - sometimes I can see it is coming from Index DB sometimes it comes from WebSQL. When coming from WebSQL, the driver on Mac shows blank too. The difference seems to be whether I have done “inspect” on Chrome before accessing the app. I can see both version of the record in the chrome inspector for IndexDB and Web SQL.

My concern is that I have now had an instance of “lost” data on the iOS app. i.e. getting out of date data after the app was closed and reopened. Which feels like maybe the data is stored in two ways on iOS too? Hence my desire to be sure which is being used for Storage and for some consistency in the web version.

Any advice would be welcome.


Check storage.driver property for its content to see which driver is used.



As I said in my original post, storage.driver is blank. But can see in chrome on Mac it is in fact using “WebSQL”. How do I check on iOS?


Sorry I missed that. I would start a blank app and add minimal code to test the storage features I need but are failing in isolation.



No problem, but I can’t create a simple test situation as the behaviour is intermittent and possibly not there at all. I just wanted some way to confirm that the underlying storage being used on iOS is in fact SQLite at any given moment in time - there must be some way to determine this? I seem to have “forced” the Chrome Mac version to use WebSQL all the time (it now always shows blank for “driver”) by explicitly specifying the preferred order, and I can confirm this in Chrome using the debug tools - but I can’t find a way to confirm in iOS - help!

The only iOS I reach is on Ionic View so cannot fully help. In my case sqlite works.

Are you sure the sqlite plugin is really included in the build? Maybe remove platform and remove plugin and then add again helps?

As the driver property is empty I would think something at lower level then javascript is going wrong

I ran my code via Xcode to an iOS iPhone 6 simulator (same as my physical device). On the simulator “storage.driver” DOES show as “cordovaSQLiteDriver”. However, the exact same code running on the real iPhone shows “storage.driver” as “null” - that does not seem right. The only thing I did in Xcode was select the physical iPhone and click run - no changes to code whatsoever. Can someone look into this please?

if the community cannot help, try raising a ticket @ support.



Tom, Thanks for helping and giving me things to follow-up. I think I got it! It’s a timing issue!!

I was alerting “storage.driver” after platform.ready(). On the simulators storage must also have been ready by the time I looked at driver. However, on my (creaking) iPhone 6, it must have been taking longer, because if I use storage.ready() after platform.ready() and then check the driver, everything is the same. i.e. It shows the driver as “cordovaSQLiteDriver” on device and simulator. The fact I wasn’t using storage.ready() was probably also the reason for the intermittent differences in the loaded data of course. Most of the time I was ok, but not always.

As usual, obvious in hindsight. Live and learn.

1 Like