Skip to main content
Inspiring
June 12, 2012
Question

Getting an error when trying to store database in cache directory

  • June 12, 2012
  • 11 replies
  • 2463 views

Hello,

"SQLError: 'Error #3125: Unable to open the database file.', details:'Connection closed.', operation:'open', detailID:'1001'"

this is my code :

sqlConn = new SQLConnection();

var str:String=File.applicationDirectory.nativePath;

var cacheDir= new File(str +"/\.\./Library/Caches");

var dbFile:File=cacheDir.resolvePath("DB.db");

sqlConn.open(dbFile);

sqlStat = new SQLStatement();

sqlStat.sqlConnection=sqlConn;

It works if I use var dbFile:File=File.applicationStorageDirectory.resolvePath("DB.db");

This topic has been closed for replies.

11 replies

Adobe Employee
June 12, 2012

File.applicationDirectory and File.applicationStorageDirectory do not map to the same location in iOS. The path will work relative to applicationStorageDirectory as you mentioned. In case you wish to use path relative to applicationDirectory, you should use "/\./Library/Caches" instead of "/\.\./Library/Caches". This is because Library/Caches is present inside application sandbox folder and you were searching inside parent folder of application sandbox folder and hence getting an error. You can use nativePath property to see the native path locations of File properties.

Inspiring
June 13, 2012

Thanks so much! ill give it a go and let you know !
why does this guide say otherwise ?
http://www.saumitrabhave.com/2011/11/air-ios-solving-apps-must-follow-ios.html