1 Reply Latest reply: Feb 24, 2010 9:02 PM by -jw RSS

    SQLError #3125

    tedalde2 Community Member

      Is this a bug or a feature? I can create a db directly inside ApplicationStorage, but not inside a (non-existent) folder in Application Storage. I get the error: SQLError: 'Error #3125: Unable to open the database file.', details:'Connection closed.', operation:'open', detailID:'1001'


      As an example, open an AIR FLA and simply test these paths to the db file:


      var dbpath:String = File.applicationStorageDirectory.url + "db/mydb"; // fails unless db is there already

      var dbpath:String = File.applicationStorageDirectory.url + "mydb"; // works regardless, even if the local storage folder does not exist yet


      var f:File = new File(dbpath);

      var sql:SQLConnection = new SQLConnection();

      sql.open(f, SQLMode.CREATE, false, 1024, null); // runtime error if path 1 is used.


      (in flash CS4)


      As a workaround I suppose I could, before creating the db, write a temp file to the path where the db should reside. That way, the path would exist. Is that the only way or am I missing something?



        • 1. Re: SQLError #3125
          -jw Community Member

          This is expected behavior.  The database will not create folders on your behalf.  To fix this you just need to add some code to ensure that the directory is already present.  For example:



          Hope that helps.