06-20-2012 02:13 AM
My Application uses a SqLite database to store data. But once the Sqlite is created by the application, the user can just close the application, browse the filesystem to reach the .db file and then delete it.
I want to know if there is any way i can prevent the user from deleting the .db in such a way. Only the application should be able to delete the database.
Something like what we have in windows wherein if a program or software is using a file and then we try maually deleting it, we get a dialog saying "Unable to delete. It is being used by another person or program".
Solved! Go to Solution.
06-20-2012 03:34 AM
Welcome to the forums.
I beleive if your application is currently using the database, it will not be deleted for the same reason as in Windows, i.e. the OS knows that someone is using the file and will lock it then. But I have not specifically tested this so I suggest that you try it yourself.
But just like Windows, I don't believe that there is a way to stop the user deleting it when the application is not running (i.e. the file is not busy). And of course you can't stop the user taking the SD Card out.
How big is this database? You might be able to copy it as a byte array to PersistentStore, and so have a backup copy.
06-20-2012 05:20 AM
I have tested it..and i can say that in blackberry, you can delete the file, while still in use.
The Database is quite huge and Persistent storage may not be an option.
Any other ideas?
06-20-2012 06:35 AM
" have tested it..and I can say that in blackberry, you can delete the file, while still in use. "
That is a bit scary.....
I have, when I had sequential files I didn't want deleted, marked them as hidden, but I'm not sure you can do that to an SQL database.
Aside from that, sorry no idea, hope someone else has.