Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Query a Local Database in AIR's Desktop RIA Environment

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.


advertisement
renewed interest in JavaScript—spurred by the AJAX craze—and the appearance of compelling applets that run on the desktop (e.g., Windows Vista Gadgets and Mac Dashboard Widgets) seem to have sparked an evolution in the traditional desktop programming model. A number of emerging technologies such as Adobe AIR and Sun's JavaFX Script have brought web scripting/programming to desktop software design, enabling rich Internet applications (RIAs) on the desktop. In much the same way that RIAs blur the differences between the desktop and the web for the user, these new technologies largely eliminate the distinction between the programming work required for each type of application.

The degree to which these technologies have been adapted to the traditional programming model is surprising for an experienced developer, who is used to the "good old days" when desktop programming demanded difficult-to-acquire skills in technologies such as MFC or wxWidgets. So I had to try one (Adobe AIR) for myself. AIR stands for Adobe Integrated Runtime (previously known as Apollo). A cross-OS runtime environment for RIAs on the desktop, AIR essentially offers an API that JavaScript and ActionScript developers can use to interact with the client workstation. (See Sidebar 1. What Is AIR? for more details.)

This article discusses my experiences building a database application in Adobe AIR from scratch. The Adobe web site offered very few sample applications, but I'm sure more will appear as additional developers get their hands on the SDK. Since this was my first experience with AIR, I think my not-too-steep learning curve will be typical for many developers who adopt this technology, assuming they have some knowledge of JavaScript. (For this project I also used SQL; if you don't have any expertise with SQL, consult the AIR documentation for a good introduction.)



The Demo Project
I often struggle with connecting a Flash application to relational database persistent storage (I even wrote a DevX article about it). I encountered the same difficulty with JavaScript applications. So I was excited to discover that AIR offers database connectivity with a "local" database. The AIR distribution includes a lightweight SQL engine called SQLite, which Apple has included in Mac OS for some time (including native support in the Core Data framework). According to the AIR FAQ, "Adobe AIR 1.0 will not have built in support for communicating directly with [remote] databases. However, it will be possible to write Database drivers in ActionScript (leveraging binary or XML sockets), which would allow Adobe AIR applications to communicate directly with a database (both local and remote)."

The demo project in this article is a simple query application that allows the user to submit SQL commands to a local SQLite database. It also reads command line parameters, logs activity to a file, and creates windows.

Since I do not have much experience working with Flex and I wanted to dive right in, I chose to use AIR's JavaScript/HTML programming model. To begin developing in AIR using this model, download the AIR SDK. I did not use an IDE, but you can use Dreamweaver CS3 (previous versions are not supported, and you will have to download an extensions file).

Once you download and unzip the SDK, you will have to add a reference to the bin subdirectory to your path environment variable. This will make the two utilities that you will use to run and package AIR applications (adl and adt) available at the console. Then, create a directory for your project and copy the AIRAliases.js file from the SDK there.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap