开发者

Sqlite problem within eclipse, not recognizing db file

I am having extreme difficulty 开发者_如何学Pythonin running this quiz application. The application uses a db file which is created in SQLite browser. I have a Database helper class from which I have added the path to the db.

I have also added the db file within the assets folder in my application. When I run the application I receive an unexpectedly error.

I can open the database within DDMS view and see the contents within data/data/mypackage/

When I debug this I receive an error message in Logcat and an activity thread opens which says source not found, Edit source look up Path:

I tried adding an image of log cat but I cannot do so yet.

I receive the following error:

sqlite returned: error code = 14, msg = cannot open file at source 25467 sqlite3_open_v2("/data/data/com.quiz.easy/database/quizzed", &handle, 1, NULL) failed

I have tried changing the paths within the Database helper class and the path changes but I'm not sure what is wrong.

The path within the database helper class:

public class DataBaseHelper extends SQLiteOpenHelper{

//The Android's default system path of your application database.
private static String DB_PATH = "/data/data/com.quiz.easy/databases/";
private static String DB_NAME = "quizzed";
private static String Table_name="Quiz";

I can upload all the source code if needed. I would appreciate any help with this as I am going in circles and have been trying to get this to work for a whole week.

Please help me. Thanks


already bug raised in this link

http://code.google.com/p/android/issues/detail?id=949

use the following api...

context.openOrCreateDatabase("sample.db", MODE_PRIVATE, null);

try this link

http://www.itsalif.info/content/check-if-database-exist-android-sqlite3openv2-failed


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. :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜