HTML5 and sqlite


I found a previous thread suggesting that using a sharedobject allows saving of persistent LOCAL data with openfl. What I’d like to do is be able to open, read, and write to, an sqlite database.

All the packages I can find for sqlite seem to be based on sys, so can’t be targeted on HTML5. Once I have defined my sqlite database as a shared object, is there a way I can connect/read/write information to it that I’m missing?

Thanks in advance for any suggestions.


On the web, there was a Web SQL proposal, which I believe has failed to be adopted by Mozilla, and (correct me someone if I am wrong?) IndexedDB may be the future here:

Here’s a comparison of support:


Thanks for this. From a practical point of view, how would you implement the ability to send queries to the database?

When I can access sys I use the following:

import sys.db.Sqlite;

public var localDB ="localDB.db");
var titleQuery = localDB.request("SELECT title FROM game WHERE id ="+gameId+"");

I can’t see how I would implement something similar to this using a shared object.

var localDB = SharedObject.getLocal("localDB.db"); //loads it in, but I don't think this is the same as making a connection I can operate on.
var titleQuery = ..?


Here’s an example I found:

Here’s a quick try.haxe


I can’t thank you enough for the try.haxe example. This seems like it will be perfect once I can get my head around it.