Android Question sqlite

Hamied Abou Hulaikah

Well-Known Member
Licensed User
Longtime User
my database is already exist in my phone
when i want to access and initialize it gives me error could not open database
code is :
B4X:
Sub Activity_Create(FirstTime As Boolean)
    If FirstTime Then
    
        If File.Exists(File.DirAssets, "d77.db") = True Then
            SQL1.Initialize(File.DirAssets, "d77.db", False)
    
Msgbox("connected","")
         
        Else
        Msgbox("NOT","")
        End If
    End If
    Activity.LoadLayout("Main")

End Sub
and error is
LogCat connected to: eb1fef96
--------- beginning of main
--------- beginning of system
** Activity (main) Create, isFirst = true **
main_activity_create (java line: 335)
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:318)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:228)
at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:512)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:206)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:178)
at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:894)
at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:864)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:699)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:674)
at anywheresoftware.b4a.sql.SQL.Initialize(SQL.java:37)
at b4a.sqlitelight1.main._activity_create(main.java:335)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:187)
at b4a.sqlitelight1.main.afterFirstLayout(main.java:100)
at b4a.sqlitelight1.main.access$100(main.java:17)
at b4a.sqlitelight1.main$WaitForLayout.run(main.java:78)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5942)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
 
Top