How to use SQLite in ionic2?

I use the offical example in my project and run with ios emulator ,unfortunately ,something go wrong like that : ReferenceError: Can’t find variable: sqlitePlugin
My code like that ionic 2 sqlite
Any answer I will be appreciate !! :slight_smile:

you can try this, It worked for me


Or uses Ionic components :

1 Like

Thank you @piyukore !!!
I used it and worked for me ,but I want to know where the data is stored .
I debuged in my computer with IOS emulator and safari web inspector , but I didn’t find my data in the browser storage space and anywhere ?

Thank you @LAFONT
It’s very helpful !:slight_smile:

@RocWang You are welcome!
I don’t know about that yet. Tell you if I find anything :+1:

OK,thx anyway !:smile:

i tried above link but i get error - supplied parameter do not match any signature of call. On below line i got error

let db = new SQLite();

if i write 'let db = new SQLite(‘dbname.db’);'
then above error gone and get new error that is - Property openDatabase does not exist on type SQLite.

why this all happened??

Hi , @varshil29 I didnt write like that .
Instead , U can try this :

//init database
let storage = new Storage(SqlStorage, {name: ‘mydb’});

//init table
console.log("TABLE CREATED -> " + JSON.stringify(data));
}, (error) => {
console.log("ERROR -> " + JSON.stringify(error.err));

//exec query
let sql = ‘select id,username from t_user’;

And U should do this:
import {Storage, SqlStorage} from “ionic-angular/index”;

I already used this code but i got problem in android device.
i open topic in forum. please refer link

Thank you

please refer below link

having same problem.
"- supplied parameter do not match any signature of call. "
in this line —let db = new SQLite();

I found an greate solution
The oficial documentation example doesnt works for me!

Maybe this can help someone -