Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to open database #12

Closed
yuyanghe opened this issue Apr 19, 2016 · 6 comments
Closed

Failed to open database #12

yuyanghe opened this issue Apr 19, 2016 · 6 comments
Assignees
Labels

Comments

@yuyanghe
Copy link

I use this in my demo . why it can't create database?

04-19 11:04:58.985 19818-19818/? E/SQLiteLog: (14) cannot open file at line 33279 of [fe7d3b75fe]
04-19 11:04:58.985 19818-19818/? E/SQLiteLog: (14) os_unix.c:33279: (2) open(/data/data/com.weiyun.fastquery/databases/weiyun.db) -
04-19 11:04:58.985 19818-19818/? E/SQLiteDatabase: Failed to open database '/data/data/com.weiyun.fastquery/databases/weiyun.db'.
android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
at io.requery.android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
at io.requery.android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:221)
at io.requery.android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:205)
at io.requery.android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:468)
at io.requery.android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:189)
at io.requery.android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:181)
at io.requery.android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:835)
at io.requery.android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:820)
at io.requery.android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:726)
at io.requery.android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:245)
at io.requery.android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:174)
at com.weiyun.fastquery.db.UploadDBHelper.insertJob(UploadDBHelper.java:38)
at com.weiyun.fastquery.MainActivity.onCreate(MainActivity.java:33)

@npurushe
Copy link
Contributor

Unfortunately its a bit of a generic error that means the file could not be opened. Make sure you only create one SQLiteOpenHelper, or always close the db before trying to open it again. When does that happen, the first time you run your app? Also which version are you using 3.12.2?

@yuyanghe
Copy link
Author

I am sure only create one SQLiteOpenHelper, and i use 3.12.2, it happen at the first time i run my app. my error is happen at sqlite_open_v2 in android_database_SQLiteConnection.cpp nativeopen function . it can open database but can't create db. Could you send me a demo , show how to use you lib by source integration ? my email is 8394420@qq.com or hyy8394420@gmail.com

@npurushe
Copy link
Contributor

It should work fine if that is the case. What version of Android are you running this on?

@npurushe npurushe added the bug label Apr 20, 2016
@npurushe npurushe self-assigned this Apr 20, 2016
@npurushe
Copy link
Contributor

Was able to reproduce this problem, sqlite is not able to create the file natively. Will post an updated build with the fix soon.

@npurushe
Copy link
Contributor

Please try the 3.12.2-1 version

@Baronbs
Copy link

Baronbs commented Oct 2, 2017

can anyone please help me

10-02 20:29:35.538 9551-9551/mypackage E/SQLiteAssetHelper: Couldn't open bsdb.db for writing (will try read-only):
com.readystatesoftware.sqliteasset.SQLiteAssetHelper$SQLiteAssetException: Missing databases/bsdb.db file (or .zip, .gz archive) in assets, or target folder not writable
at android.content.res.AssetManager.openAsset(Native Method)
at android.content.res.AssetManager.open(AssetManager.java:374)
at android.content.res.AssetManager.open(AssetManager.java:348)
at com.readystatesoftware.sqliteasset.SQLiteAssetHelper.copyDatabaseFromAssets(SQLiteAssetHelper.java:436)
at com.readystatesoftware.sqliteasset.SQLiteAssetHelper.createOrOpenDatabase(SQLiteAssetHelper.java:400)
at com.readystatesoftware.sqliteasset.SQLiteAssetHelper.getWritableDatabase(SQLiteAssetHelper.java:176)
at com.readystatesoftware.sqliteasset.SQLiteAssetHelper.getReadableDatabase(SQLiteAssetHelper.java:254)
at
mypackage .Database.Database.getCarts(Database.java:33)
at mypackage .Cart.loadList(Cart.java:63)
at mypackage .Cart.onCreate(Cart.java:56)
at android.app.Activity.performCreate(Activity.java:6975)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants