Results 1 to 1 of 1

Thread: Local SQL database using AIR

  1. #1
    uretech987 is offline Senior Member
    Join Date
    Nov 2008
    Posts
    218
    Rep Power
    4

    Default Local SQL database using AIR

    One good feature in Adobe's AIR, the platform for developing rich Internet apps is a
    database engine that runs within AIR's runtime environment. Since all the database files are stored locally, there is no need of an external database connection. This also implies that persistent application data can be stored conveniently on the local drive. The local database is stored as a single file in the computer's file system. The runtime is responsible for creation, retrieval and manipulation of data in this database file. In the following implementation, we will be using synchronous mode of execution to create RIAs with AIR.

    Implementation

    Let's start with installation of AIR SDK. This can be downloaded from 'www.adobe.com or you can also get it from this issue's DVD. Once extracted to a folder, set the PATH environment variable. This can be done by adding reference of extracted folder to it. In our case, we added the following path in the end of PATH environment variable 'C:\AdobeAIRSDK\bin'. The bin folder present in SDK contains ADL and ADT tools.AIR debug launcher or ADL is used to run applications without packaging them, whereas AIR developer tool is for packaging your application as an AIR file for distribution. One more important file that we would be using in this implementation is 'AIRaliases.js' present in 'C:\AdobeAIRSDK \frameworks\libs\air' folder. This file provides alias definition that allows one to run 'ActionScript' runtime class i.e. air.FileStream, air.SQL Database etc. To use this file, one needs to add following script reference in HTML page:

    Start with creating a folder that contains three files: XML file (pcquest.xml), HTML file (pcquest.html) and AIRaliases.js file as explained above. We will start with the applications descriptor file (pcquest.xml). Here is the content of this file along with explanation:

    Add the attribute that defines the namespace for AIR as shown. Last part shows the version of AIR used:

    Next line shows attribute to uniquely identify application:

    Name:  Local SQL database using AIR.jpg
Views: 481
Size:  35.7 KB

    To define properties of the application window:

    Now we have createq the required descriptive file. Let's create a HTML page that contains code to create database and then display that database.

    The 'init()' method is defined in '<body>' tag's 'onload' event handler, this is called when application starts loading. Instance of SQLConnection()' method is created in it for connection to the database. After connection is established, it is opened using 'open()' and parameter 'null' signifies that instead of disk, database would be created in computer memory as shown:

    Next step is to create the table. This is done by creating an instance of 'SQL Statem ent()' and passing connection 'conn' to it:

    Once we have the table, we need to add data to it. This is accomplished by using 'addData()' function with 'insert-Stmt' and 'insertStmt2'.

    Once we have the table with data, we have to retrieve this data and then display it. To accomplish retrieval, first createan instance of'SQLStatementO', i.e. selectStmt and pass your query as text property of this instance.

    Finally retrieved data is rendered using'renderResult()' function.

    To check the results of the created application. open command prompt and move to the application folder and type in the window:

    Finally one can easily package AIR application in just two steps. start with creating certificate and key pair for application:

    To create air installer file simply run following command it will prompt for password:
    Last edited by uretech987; 04-15-2009 at 12:04 PM.

Similar Threads

  1. Database Normalization in SQL Database
    By Millerjames in forum Programming
    Replies: 1
    Last Post: 01-23-2010, 03:17 PM
  2. Link to a local database
    By Annette Bening in forum Software Jargons
    Replies: 5
    Last Post: 10-20-2009, 11:08 AM
  3. How to install a local printer
    By andressa143 in forum Windows Vista
    Replies: 1
    Last Post: 09-15-2009, 11:23 AM
  4. Local sw backup for my network to pc
    By gilly25 in forum General Networking
    Replies: 0
    Last Post: 05-04-2009, 10:14 AM
  5. local sw backup for my network to pc
    By gilly25 in forum Everything Else
    Replies: 0
    Last Post: 05-02-2009, 09:34 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
SEO by SubmitEdge

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48