Problem when reading SQLite Database

junaidahmed

Well-Known Member
Licensed User
Longtime User
I am facing problem when opening sqlite database. "Attempt to write Readonly Databse",my sqlite database path is "/mnt/sdcard/external_sd/data/Mis.S3db".Pls advise where it is problem.
 

tremara1

Active Member
Licensed User
Longtime User
sqlLite db

This is the code I used in an app I just finished...it checks if the db is in the default external (sd card) if not it copies it from a copy in dir assets folder.
B4X:
If File.Exists(File.DirDefaultExternal,"meds.db") = False Then
      File.Copy(File.DirAssets,"meds.db",File.DirDefaultExternal,"meds.db")
     End If
     If SQL1.IsInitialized = False Then
               SQL1.Initialize(File.DirDefaultExternal, "meds.db", False)
     End If
It worked in the emulator and on my 2 devices.
I think it might be to do where your db is located....hope this helps
 
Upvote 0
D

Deleted member 103

Guest
Hi junaidahmed,

I also had the same problem, I've renamed the file with small letters eg "Mis.S3db" in "mis.s3db"and already it has worked.

I also used the example of tremara1.

Ciao,
Filippo
 
Upvote 0
Top