在Android中使用存在SQLite数据库 [英] Using existed SQLite database in Android

查看:156
本文介绍了在Android中使用存在SQLite数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是在我的Andr​​oid应用程序中使用SQLite的存在的数据库。
要管理它,我用了著名的文章中,描述我的任务 - 的http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications

My problem is in using the existed sqlite-database in my android application. To manage it, I used the well-known article, that describes my task - http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications

虽然这个应用程序启动时,我得到了错误:

While this app starts, I'm getting the error:

08-17 06:35:18.416: ERROR/Database(286): sqlite3_open_v2("data/data/com.jeston.existed.sqlite/databases/android_test_db.db", &handle, 1, NULL) failed
08-17 06:35:18.437: ERROR/AndroidRuntime(286): Uncaught handler: thread main exiting due to uncaught exception
08-17 06:35:18.457: ERROR/AndroidRuntime(286): android.database.sqlite.SQLiteException: unable to open database file 

我怀疑我用错了路径mydatabase.I放下我android_test_db文件夹的资产,并写在博客上,给了

I suspect that I use wrong path to mydatabase.I put down my android_test_db file to assets folder and, as written in the blog, gave the

private final static String DB_PATH = "data/data/com.jeston.existed.sqlite/databases/";
private final static String DB_NAME = "android_test_db.db";

所以,我的问题是,这些pathes正确或没有?或者可能是,我在共同的错误的方式?

So, my question is these pathes are correct or no? or may be, i'm on the wrong way in common?

感谢大家。

推荐答案

该数据库的扩展名必须是因为它是完全一样的。
此外,我认为你的主要问题是,你指定了错误的包。它必须是根包。尝试:

The db name extension has to be exactly the same as it is. Moreover, I think your main problem is that you specify the wrong package. It has to be the root package. Try that:

private final static String DB_PATH = "data/data/com.jeston.existed/databases/";

这篇关于在Android中使用存在SQLite数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆