# Including Indexeddb in Ionic2

**URL:** <https://forum.ionicframework.com/t/including-indexeddb-in-ionic2/51563>\
**Category:** ionic-v3\
**Created:** [May 9, 2016, 7:17pm UTC](https://forum.ionicframework.com/t/including-indexeddb-in-ionic2/51563 "2016-05-09T19:17:40Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![seanmavley](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/seanmavley/32/100343_2.png) [@seanmavley](https://forum.ionicframework.com/u/seanmavley)\
**Post date:** [May 9, 2016, 7:17pm UTC](https://forum.ionicframework.com/t/including-indexeddb-in-ionic2/51563/1 "2016-05-09T19:17:40Z")

</div>

I want to use [angular-indexeddb](https://github.com/bramski/angular-indexedDB) or [Dexie](http://dexie.org) in my ionic 2 project.

How should I go about it?

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [May 9, 2016, 7:45pm UTC](https://forum.ionicframework.com/t/including-indexeddb-in-ionic2/51563/2 "2016-05-09T19:45:23Z")

</div>

Why do you prefer this over sqlite?

---

<div class="post-metadata">

**Author:** ![seanmavley](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/seanmavley/32/100343_2.png) [@seanmavley](https://forum.ionicframework.com/u/seanmavley)\
**Post date:** [May 9, 2016, 7:50pm UTC](https://forum.ionicframework.com/t/including-indexeddb-in-ionic2/51563/3 "2016-05-09T19:50:22Z")

</div>

Maybe that’s what I’ve played with before, and thought could get it around to continue using. Will look into the sqlite.

thank

---

<div class="post-metadata">

**Author:** ![jezswift](https://avatars.discourse-cdn.com/v4/letter/j/a5b964/32.png) [@jezswift](https://forum.ionicframework.com/u/jezswift)\
**Post date:** [May 10, 2016, 1:11am UTC](https://forum.ionicframework.com/t/including-indexeddb-in-ionic2/51563/4 "2016-05-10T01:11:24Z")

</div>

Hi Sean,

We use indexedDB in all of our projects. Just include the indexedDB polyfill from here: [https://github.com/MSOpenTech/cordova-plugin-indexedDB](https://github.com/MSOpenTech/cordova-plugin-indexedDB)

After that you just create your DB code as you normally would do. I’m assuming you know how to use indexedDB!!

Why are we using indexedDB over SQLite… SQLite is deprecated, indexedDB is the new kid on the block.  
However, ios does not fully support it yet. The polyfill fixes 90% of the issues but it all depends on how complex your DB calls and functions are. You may be lucky and never come across any issues.

---

<div class="post-metadata">

**Author:** ![seanmavley](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/seanmavley/32/100343_2.png) [@seanmavley](https://forum.ionicframework.com/u/seanmavley)\
**Post date:** [May 10, 2016, 2:13am UTC](https://forum.ionicframework.com/t/including-indexeddb-in-ionic2/51563/5 "2016-05-10T02:13:09Z")

</div>

Thank you for pointing that out. Haven’t come across that yet. Will dig deeper I to it.

And yes, I’ve played with indexeddb, so will be able to take it from there.

Just wondering why sqlite in the browser is getting deprecated if not already, yet ionic out of the box supports it but leaves indexeddb behind. Unless there’s something sqlite isn’t telling us. Lol

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [May 13, 2016, 10:53pm UTC](https://forum.ionicframework.com/t/including-indexeddb-in-ionic2/51563/6 "2016-05-13T22:53:45Z")

</div>

> [@jezswift](#):
>
> SQLite is deprecated

Do you have a citation on this? Are you sure you’re not referring to WebSQL? As far as I know, SQLite is alive and well, especially in mobile device OSes such as those targeted by Ionic.

---

<div class="post-metadata">

**Author:** ![imaatLuciano](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/imaatluciano/32/102414_2.png) [@imaatLuciano](https://forum.ionicframework.com/u/imaatLuciano)\
**Post date:** [April 28, 2017, 7:29pm UTC](https://forum.ionicframework.com/t/including-indexeddb-in-ionic2/51563/7 "2017-04-28T19:29:55Z")

</div>

But SQLite implementation in Ionic isn’t it based in WebSQL? I mean [http://ionicframework.com/docs/native/sqlite/](http://ionicframework.com/docs/native/sqlite/) makes use of cordova-sqlite-storage, that uses WebSQL. Is there another way of implementing SQLite outside WebSQL? Maybe I have a confusion…

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [April 28, 2017, 7:32pm UTC](https://forum.ionicframework.com/t/including-indexeddb-in-ionic2/51563/8 "2017-04-28T19:32:02Z")

</div>

cordova-sqlite-storage just mimics WebSQL’s API, it doesn’t actually use it.

---

<div class="post-metadata">

**Author:** ![imaatLuciano](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/imaatluciano/32/102414_2.png) [@imaatLuciano](https://forum.ionicframework.com/u/imaatLuciano)\
**Post date:** [April 28, 2017, 7:33pm UTC](https://forum.ionicframework.com/t/including-indexeddb-in-ionic2/51563/9 "2017-04-28T19:33:26Z")

</div>

Are you sure? [http://nimb.ws/8J6dzR](http://nimb.ws/8J6dzR)

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [April 28, 2017, 7:36pm UTC](https://forum.ionicframework.com/t/including-indexeddb-in-ionic2/51563/10 "2017-04-28T19:36:06Z")

</div>

Your link doesn’t work for me, but [yes, I’m sure](https://github.com/litehelpers/Cordova-sqlite-storage):

> Native interface to sqlite in a Cordova/PhoneGap plugin for Android, iOS, macOS, and Windows 10 (UWP), **with API similar to** HTML5/Web SQL API.

---

<div class="post-metadata">

**Author:** ![imaatLuciano](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/imaatluciano/32/102414_2.png) [@imaatLuciano](https://forum.ionicframework.com/u/imaatLuciano)\
**Post date:** [April 28, 2017, 7:38pm UTC](https://forum.ionicframework.com/t/including-indexeddb-in-ionic2/51563/11 "2017-04-28T19:38:23Z")

</div>

![image](https://global.discourse-cdn.com/ionicframework/original/3X/3/5/35c2404da3c3ddcd85305679a0135470c65fca2e.png) Is that ok then?

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [April 28, 2017, 7:42pm UTC](https://forum.ionicframework.com/t/including-indexeddb-in-ionic2/51563/12 "2017-04-28T19:42:47Z")

</div>

I don’t understand what you are trying to say. Ionic-storage is a higher-level concept than SQLite or WebSQL. It can use either one of them (or IndexedDB), which is convenient when testing in a browser environment where SQLite is not available. While the SQLite cordova plugin has a similar API to WebSQL, it does not actually use WebSQL or have anything to do with it. More docs [here](https://github.com/driftyco/ionic-storage) (see the configuration section at the bottom).

---

<div class="post-metadata">

**Author:** ![imaatLuciano](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/imaatluciano/32/102414_2.png) [@imaatLuciano](https://forum.ionicframework.com/u/imaatLuciano)\
**Post date:** [April 28, 2017, 7:46pm UTC](https://forum.ionicframework.com/t/including-indexeddb-in-ionic2/51563/13 "2017-04-28T19:46:25Z")

</div>

Sorry, I’m not trying to say the opposite, it’s just that I don’t understand how it really works and since I saw in the browser that it’s under WebSQL db, I thought it was using it for all. Thank you for making it clear now.
