3 Replies Latest reply on Aug 20, 2012 9:57 PM by FreddyK

    How to copy sqlite database from applicationDirectory to documentsDirectory


      I am having problems using the ‘File’ function in Adobe Flex to copy a sqlite database from the read only applicationDirectory to the users documentsDirectory.  When I use the code below the only thing that appears in the user documentsDirectory is a 1k to 4k file.  The actual file size of the database is around 350k.


      Am I not giving the file enough time to copy over?


      I am developing on a Mac but I think I remember duplicating the error on a PC as well.  This bug has been keeping me from launching my app for far too long.  Any ideas would be appreciated.


      Here is the code I am using:

      public function copyDB():void


                var dbFile:File = File.applicationDirectory.resolvePath("db/myDataStorage.db");

                var dbWorkedFile:File = File.documentsDirectory.resolvePath("myDataStorage.db");


                          trace("db Does Not Exist");


                } else {

                          trace("db Exists");

                          //The database has already been installed.  Launch app.


                dbConn = new SQLConnection();




      I got the above code from this Adobe Cookbook recipe:

      http://cookbooks.adobe.com/post_Include_existing_SQLite_database_in_an_AIR_applica-10483.h tml