Android Question The correct folder for SQLite table?

D

Deleted member 103

Guest
Hi,

I have in an app the same SQL error as here.
As Erel writes, or as I understood, one should use "File.DirInternal".
My question: Why is "File.DirDefaultExternal" wrong?

B4X:
Sub Service_Create
    'This is the program entry point.
    'This is a good place to load resources that are not specific to a single activity.
   
    SQL1.Initialize(File.DirDefaultExternal, "chat.db", True)
    Dim mp As Map = CreateMap("id": "INTEGER", "SenderId": "TEXT", "Title": "TEXT", "Body": "TEXT", "Name": "TEXT", _
                                "User": "INTEGER", "datum": "INTEGER", "Posted": "TEXT", "Received": "TEXT", "indexSender": "INTEGER")
    DBUtils.CreateTable(SQL1, TableName, mp, "id")

android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:209)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:193)
at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177)
at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:804)
at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:789)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:694)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:669)
at anywheresoftware.b4a.sql.SQL.Initialize(SQL.java:37)
at fg.Solitario_free.starter._service_create(starter.java:351)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:153)
at fg.Solitario_free.starter.onCreate(starter.java:55)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2577)
at android.app.ActivityThread.access$1600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1338)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)

android.database.sqlite.SQLiteDiskIOException: unknown error (code 10): Could not open database
at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:209)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:193)
at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177)
at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:829)
at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:814)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:709)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:684)
at anywheresoftware.b4a.sql.SQL.Initialize(SQL.java:37)
at fg.Solitario_free.starter._service_create(starter.java:351)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:153)
at fg.Solitario_free.starter.onCreate(starter.java:55)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2731)
at android.app.ActivityThread.access$1800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1403)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5299)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:641)
at dalvik.system.NativeStart.main(Native Method)
 

DonManfred

Expert
Licensed User
Longtime User
This is the english part of the forum. Please write ENGLISH here!
 
Upvote 0

Eme Fibonacci

Well-Known Member
Licensed User
Longtime User
A good reason to use DirInternal:

From developer.android.com

"By default, files saved to the internal storage are private to your application and other applications cannot access them (nor can the user)"
 
Upvote 0

KMatle

Expert
Licensed User
Longtime User
But with me is always German, why?

Please open a new thread for this and take a look at your parent's beginners guide for Italian guys (I assume they used the German edition. See chapter 5: "...la versione originale del testo è in tedesco...) :)
 
Upvote 0
Top