Hello,
I’m looking for the best practice solution for a SQLite database Issue:
I have a SQLite database which is already populated that I want to use in my app. Where do I put that file so Corona SDK will pick it up?
In an answer I saw on that issue it says (from: http://developer.anscamobile.com/forum/2010/05/15/sqlite-openingcreating-database):
If you already have your SQLite db you can place it in the same folder as your main.lua file so it’s easy to find.
For example:
1
2
3
4 local path = system.pathForFile(“data.db”, system.ResourceDirectory)
db = sqlite3.open( path )
…
However, on the DB tutorial the suggestion was (from http://blog.anscamobile.com/2012/04/tutorial-database-access-in-corona/):
NOTE: The recommended location for creating a database is system.DocumentsDirectory (as shown in the example). This will ensure that you are able to read/write to your database, and that it is in a safe location. Your project resource directory is not writable, and temp/cache directories are periodically wiped clean by the OS.
But, when I first install the App, I don’t have Access to the system.DocumentsDirectory.
Do you suggest I’ll put it DB in the system.ResourceDirectory then Move it to the system.DocumentsDirectory?
Thanks
[import]uid: 43596 topic_id: 24938 reply_id: 324938[/import]