Vijaya
Vijaya

Reputation: 564

sqlite3_open_v2("/data/data/com.android.packagename/databases/dump.sqlite", &handle, 1, NULL) failed

I am working with sqlite database.... app is working in 2.3 and later... when I am trying to run in 2.2 ... I got an error like ....

E/Database(2476):sqlite3_open_v2("/data/data/com.android.packagename/databases/dump.sqlite", &handle, 1, NULL) failed

database has some problem.

when i am trying to run my app in 2.2. my logcat shows

E/Database(2476):sqlite3_open_v2("/data/data/com.android.canadaQbank/databases/dump.sqlite", &handle, 1, NULL) failed
D/asset(2476): Data exceeds UNCOMPRESS_DATA_MAX (4594688 vs 1048576)
D/AndroidRuntime(2476): Shutting down VM
W/dalvikvm(2476): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
D/dalvikvm(2476): GC_FOR_MALLOC freed 6256 objects / 356848 bytes in 165ms
E/AndroidRuntime(2476): FATAL EXCEPTION: main
E/AndroidRuntime(2476): java.lang.Error: Error copying database
E/AndroidRuntime(2476):     at com.android.canadaQbank.DBAdapter.createDataBase(DBAdapter.java:83)
E/AndroidRuntime(2476):     at com.android.canadaQbank.Select.getUsers(Select.java:110)
E/AndroidRuntime(2476):     at com.android.canadaQbank.Select.onCreate(Select.java:92)
E/AndroidRuntime(2476):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
E/AndroidRuntime(2476):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
E/AndroidRuntime(2476):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
E/AndroidRuntime(2476):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
E/AndroidRuntime(2476):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
E/AndroidRuntime(2476):     at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(2476):     at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(2476):     at android.app.ActivityThread.main(ActivityThread.java:4627)
E/AndroidRuntime(2476):     at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(2476):     at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime(2476):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
E/AndroidRuntime(2476):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
E/AndroidRuntime(2476):     at dalvik.system.NativeStart.main(Native Method)

Please anyone help...

Upvotes: 7

Views: 10439

Answers (2)

Aniket Kamthe
Aniket Kamthe

Reputation: 51

private boolean checkDataBase(){

    SQLiteDatabase checkDB = null;

    try{
        String myPath = DB_PATH + DB_NAME;
        checkDB = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READONLY);

    }catch(SQLiteException e){

        //database does't exist yet.

    }

    if(checkDB != null){

        checkDB.close();

    }

    return checkDB != null ? true : false;
}

You can try it, hope this will be help you. And also check your dadabase version which support by Android 2.2. all the best.

Upvotes: 1

Deepak
Deepak

Reputation: 2009

I am also having same problem sqlite3_open_v2 failed

but After searching on this problem I found this link and I modified my code according to this link and the modified code is look like this:

public boolean databaseExist()
{
    File dbFile = new File(DB_PATH + DB_NAME);
    return dbFile.exists();
}

hope this also helps in solve your problem. :)

Upvotes: 12

Related Questions