Download SQLite db without dialog box.


I have an air app which I would like to download a couple sqlite databases in the background. I was using this code (which produces a dialog box), and it worked just fine:

        private function downloadFile(e:MouseEvent)
             var downloadURL:URLRequest;
            downloadURL = new URLRequest();
            downloadURL.url = "";
            file = File.documentsDirectory;
          file.addEventListener(Event.COMPLETE, completeHandler);
  , "downloaded.db");
            private function completeHandler(e:Event):void
                  log.text = "Download Complete";
                  database = File.documentsDirectory.resolvePath("downloaded.db");
        private function openDB():void
            log.text = "Opening DB";
            connection.addEventListener(SQLEvent.OPEN, openSuccess);
            connection.addEventListener(SQLErrorEvent.ERROR, openFailure);
               private function openSuccess(e:SQLEvent):void
                  tf.text = "Open Success";
                  query.sqlConnection = connection;
                  query.addEventListener(SQLEvent.RESULT, onQResult);
                  query.addEventListener(SQLErrorEvent.ERROR, onError);
                  query.text = "SELECT latitude, longitude from latLong";

Now, I am trying to do the file transfer with URLLoader, but I get SQLError: 'Error #3115: SQL Error.', details:'no such table: 'latLong'', operation:'execute', detailID:'2013' . I have verified that the db I am trying to download is intact and should open fine, so I am assuming that the URLLoader is messing it up somehow. I have tried to take the downloaded info and make it into a Database and File, both give the error above. Any Ideas how to get this db down in the background, while still being recognizable?


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AreDubyaAuthor Commented:
Solved --- For those who may be interested, I needed to set the URLLoaderDataFormat to BINARY and then do this:

//This is triggered by the loader's complete Event:

            private function parseDB(e:Event):void
                        //db = previously declared as File
                  db = File.documentsDirectory.resolvePath("myDB.db");
                  fs = new FileStream();
        , FileMode.WRITE);
                  fs.addEventListener(Event.COMPLETE, openDB);
                  trace("ParseDBCompleted with no errors");


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.