Chapter 10. Embedded SQL Database Programming

Adobe AIR doesn’t include only Flash Player to execute SWF content and only the WebKit engine to load HTML content and JavaScript. AIR also has an embedded version of the SQLite database engine that makes the runtime truly complete; SQLite gives developers the opportunity to store data locally offline and to do it via the same language they use to store data for web applications: SQL.

Widely used across platforms, SQLite is an open source, award-winning database engine that implements the SQL-92 specifications (

SQLite in Adobe AIR gives applications the ability to persistently store data and easily manage it. This data can be stored locally in offline situations but then can be synchronized with network data store. With the 1.5 version of Adobe AIR, it isn’t possible, however, to natively connect to remote databases.

To be able to access, store, and manipulate data in a SQLite database in Adobe AIR, you first must create the database as a local file. Each database needs its own local file. The AIR SDKs contain the APIs you need to work with SQLite via ActionScript or JavaScript. For ActionScript code, SQL database classes are in the package, whereas for JavaScript, the classes can be directly instanced by using AIR aliases (you just have to import the AIRAliases.js file into your HTML document).

Creating a Database


You need to create a local database using SQLite.


Create a local ...

Get Adobe AIR 1.5 Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.