【发布时间】:2016-02-05 08:35:21
【问题描述】:
在我的应用程序中,我使用 ORMLite 在我的 SQLite 数据库中插入数据。在某些设备上插入数据时出现以下错误:
02-05 09:29:56.864 22365-22441/com.app E/SQLiteLog﹕ (5) statement aborts at 2: [PRAGMA journal_mode=PERSIST]
02-05 09:29:56.864 22365-22441/com.app W/SQLiteConnection﹕ Could not change the database journal mode of '/data/data/com.app/databases/app.db' from 'wal' to 'PERSIST' because the database is locked. This usually means that there are other open connections to the database which prevents the database from enabling or disabling write-ahead logging mode. Proceeding without changing the journal mode.
我不知道如何为 ORMLite 解决这个问题。有人可以解决我的问题吗?只访问一个 SQLOpenHelper 并不能解决我的问题,因为我使用的是 ORMLite 并且不直接从我的代码中使用 SQLOpenHelper。
【问题讨论】:
-
@AmitVaghela 他没有使用 ORMLite
-
检查该解决方案它将解决您的问题@Bart Bergmans
-
@AmitVaghela 他的解决方案只使用了一个 SQLOpenHelper,我没有使用一个,因为我使用的是 ORMLite(这也是他的解决方案,使用 ORMLite)
-
你有解决方案,很高兴知道@Bart Bergmans