Skip to main content
Inspiring
Jun 12, 2012 5:32 AM UTC
Question

Getting an error when trying to store database in cache directory

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 is closed to new replies. Start a new post to keep the conversation going.

11 replies

Adobe Employee
Jun 12, 2012 5:31 PM UTC

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.

Translate
Inspiring
Jun 13, 2012 10:42 AM UTC

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

Translate