RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Query a Local Database in AIR's Desktop RIA Environment : Page 4

One of the more intriguing features of Adobe Integrated Runtime (AIR) is its database connectivity with a local database. Learn how to leverage this feature in desktop by walking through the development of a database application in AIR.

Signed, Sealed, Delivered
Once the application has been built, you can distribute the *.air package generated by adt to the users. In order to install the application and run it, the users must have the AIR environment installed. If not, they'll need to download it.

To install the application, the users simply click on the *.air file (AirQuery.air in this case). They will be shown the install screen in Figure 2.

Click to enlarge

Figure 2. Installing the Application

Once the user selects the directory where he or she wants to install the application (the screen following the one shown in Figure 2 provides the option to do so), an executable by the name that you specified in the XML application descriptor will be placed there, along with the supporting files. I deployed the project on a Windows machine in a directory called AirQuery. Figure 3 shows the contents of this directory.

Click to enlarge

Figure 3. Deployment Directory Structure in Windows

Other directories of interest include:

  • The current user's Application Data\AirQuery\Local Store directory, where the SQLite database is placed (you can launch the application from the console with a parameter if you want to specify a database name other than the default test.db)
  • The current user's My Documents directory, where the application logs events to the AirQuery.log file (functionality implemented by the log function in AirQuery.js; notice that the air.trace function is available only at debug time, when executing the code through adl; no messages will be written to the console by the compiled exe).

When deployed and run successfully a Windows machine, the application should appear on screen like Figure 4.

Click to enlarge

Figure 4. Deployed and Running on Windows

Can You Live Without AIR?
As you stepped through this example, I hope you've seen that learning AIR's features is reasonably easy and that incorporating it into an existing project is a breeze. Since AIR operates within existing development environments (JavaScript, Flex, ActionScript), its limitations are for the most part the shortcomings of these environments. From a database perspective, the local SQLite engine is a huge step forward but being stuck using it is a hindrance, but it seems to be a temporary one.

AIR will be most beneficial to JavaScript developers who want to create desktop applications with rich media capabilities (provided by the Flash runtime) and to ActionScript developers who want to extend Flash applications to the desktop to take advantage of the local file system, database persistence capabilities, etc. It is too early to gauge the runtime's performance, but if Flash is any indication, it should be possible to create some impressive applications. I am suitably impressed with AIR.

Razvan Petrescu has 10 years experience in technology as a systems analyst, architect, developer, and database administrator. He is currently working for a large healthcare company in the Midwest.
Email AuthorEmail Author
Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date