Ionic native sqlite plugin: no such table

I’m using ionic native sqlite plugin to store local cache objects. On Android it works fine, but on iOS, it’s always no such table: mytable, mytable is the table name I’m using. It’s created with a statement like this

mytable (
                  cache_key CHAR(255) UNIQUE,
                  cache_value TEXT NOT NULL)`

I’ve tried changing table name, but the error is always no such table.


the same problem here. My db works perfectly in Android, but in iOS I get the “No such table error”. Any ideas?

Just add that I’m able to open de DB properly:

if(ionic.Platform.isIOS()){"ios platform....");
	this.mbTilesDB = window.sqlitePlugin.openDatabase( {name:url, iosDatabaseLocation: 'Documents'}, 
              function(){"------------------------MBTiles DB oberta OK!");
          }, function(){"-------------------------MBTiles DB NO oberta KO!");



Did you try to execute something on the table? My problem was’t during opening the database, it was during the time a sql statement needs to execute against a table - which I assumed to have been created but not so on iOS, it always says ‘no such table’.


I think I didn’t explain myself very well.

That’s the point for me too, my database is properly created, and indeed, I can open the database without problems (with the code of my last message).

The problem is when I try to execute a SELECT against that database:

this.mbTilesDB.executeSql("SELECT tile_data as myTile FROM tiles WHERE zoom_level = ? AND tile_column = ? AND tile_row = ?", [z, x, y], function (res) { (...)

It says: no such table

In Android is working properly.

Maybe is a problem related to the location of the Database? In which path have you stored your database? In my case is in ‘Documents’

Here is what I did that worked for me. Before executing a “SELECT” statement, always execute "CREATE TABLE IF NOT EXIST ", it adds performance overhead, but it works.

Maybe the problem comes from asynchronous execution, and executing a “create table if not exists” should only be required once per app load, technically speaking?