无法与SQLiteAssetHelper打开数据库 [英] Can't open database with SQLiteAssetHelper

查看:209
本文介绍了无法与SQLiteAssetHelper打开数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
  的Andr​​oid源码返回错误:code = 14

我已经使用SQLiteAssetHelper类/库来操纵从资产数据库/数据库文件夹像在表明的链接。我也正是所有指令,但我仍然不能访问数据库。

I have used SQLiteAssetHelper class/library to manipulate a database from assets/databases folder like indicated in that link. I did exactly all the instructions, but i still can't access to the database.

09-27 19:35:46.417: I/Database(27474): sqlite returned: error code = 14, msg = cannot open file at source line 25467
09-27 19:35:46.417: E/Database(27474): sqlite3_open_v2("/data/data/com.gatec.douaa/databases/data", &handle, 2, NULL) failed
09-27 19:35:46.428: W/SQLiteAssetHelper(27474): could not open database data - unable to open database file
09-27 19:35:46.428: W/SQLiteAssetHelper(27474): copying database from assets...
09-27 19:35:46.447: W/SQLiteAssetHelper(27474): extracting file: 'database.db'...
09-27 19:35:46.477: E/SQLiteAssetHelper(27474): Couldn't open data for writing (will try read-only):
09-27 19:35:46.477: E/SQLiteAssetHelper(27474): com.readystatesoftware.sqliteasset.SQLiteAssetException: Missing databases/data.zip file in assets or target folder not writable

code:

Code:

public class MyDatabase extends SQLiteAssetHelper {

    private static final String DATABASE_NAME = "data";
    private static final int DATABASE_VERSION = 1;

    public MyDatabase(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);


    }

任何帮助吗?不知道问题的根源。

Any help please? Don't know the source of the problem.

推荐答案

你为什么把你的.db文件中的.zip?请尽量把它的资产没有存档。或者你可以尝试把一个小不-问题.db文件的ZIP压缩文件的理解,其中问题。

Why did you put your .db file in a .zip ? Please try put it in assets without archived. Or you can try put a little without-problem .db file in zip archive for understanding where problem is.

这篇关于无法与SQLiteAssetHelper打开数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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