1 Reply Latest reply on Apr 29, 2008 10:29 AM by Joe ... Ward

    Connect to SQLite DB

    peloke
      I've taken this code from the O'reilly AIR/JS book but when I try to run it via Aptana, I get errors of. I'm sure I'm just doing something stupid.

      Thanks!

      TypeError: Undefined value

      doLoad at app:/Cannonball.html : 18

      doLoad at app:/Cannonball.html : 18

      doLoad at app:/Cannonball.html : 18

      doLoad at app:/Cannonball.html : 18

      onload at app:/Cannonball.html : 30

      <html>
      <head>

      <title>Connecting to a Database</title>
      <script type="text/javascript" src="AIRAliases.js">
      </script>

      <script type="text/javascript">
      var db = new air.SQLConnection();

      function doDbOpen( event )

      {
      alert( "You are now connected to the database." );
      }
      function doLoad()
      {
      var file = air.File.applicationResourceDirectory.resolve( "cannonball.db" );
      db.addEventListener( air.SQLEvent.OPEN, doDbOpen );
      db.open( file, true );
      }

      function doUnload()
      {
      db.close();
      }
      </script>

      </head>
      <body onload="doLoad();" onunload="doUnload()">

      </body>
      </html>
        • 1. Re: Connect to SQLite DB
          Joe ... Ward Level 4
          The O'reilly book is a bit out of date. The basic principles are valid, but some of the API names have changed in the release version of AIR. For example, air.File.applicationResourceDirectory is now air.File.applicationStorageDirectory.