在Eclipse sqlite的问题,不承认数据库文件不承认、数据库文件、问题、Eclipse

2023-09-04 06:24:31 作者:对你真心纯属浪费

我有在运行此测验的应用程序极大的困难。该应用程序使用它在SQLite的浏览器中创建一个数据库文件。我从我所添加的路径DB数据库辅助类。

I am having extreme difficulty in 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.

我可以打开DDMS中查看数据库,看到的数据/数据​​中的内容/ mypackage的/

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

当我调试这个我收到一条错误消息在logcat中和活动的线程中打开它说找不到源代码,修改源查找路径:

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.

我收到以下错误:

源码返回:错误code = 14,味精=无法打开文件的源代码25467 sqlite3_open_v2(/数据/数据​​/ com.quiz.easy /数据库/被问及,和放大器;手柄,1,NULL)失败

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";

如果需要,我可以上传的所有源$ C ​​$ C。我想AP preciate任何帮助,这是我在兜圈子,并一直试图得到这个工作了整整一个星期。

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.

请帮助我。谢谢

推荐答案

我也有同样的问题 sqlite3_open_v2失败

但搜索这个问题后,我发现这链接,然后我根据这个链接,并修改code是像这样修改了code:

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