0

我使用 ormlite 数据库,有时在应用程序运行时收到:

 09-16 19:26:41.726: E/SQLiteLog(13495): (14) cannot open file at line 30176 of [00bb9c9ce4]
09-16 19:26:41.726: E/SQLiteLog(13495): (14) os_unix.c:30176: (24) open(/data/data/com.tempcontacts/databases/cashdata-journal) - 
09-16 19:26:41.726: E/SQLiteLog(13495): (14) cannot open file at line 30176 of [00bb9c9ce4]
09-16 19:26:41.726: E/SQLiteLog(13495): (14) os_unix.c:30176: (24) open(/data/data/com.tempcontacts/databases/cashdata-journal) - 
09-16 19:26:41.726: E/SQLiteLog(13495): (14) statement aborts at 15: [SELECT * FROM `reminders`] unable to open database file
09-16 19:26:41.726: E/SQLiteQuery(13495): exception: unable to open database file (code 14); query: SELECT * FROM `reminders`
09-16 19:26:41.726: W/System.err(13495): java.sql.SQLException: Problems executing Android query: SELECT * FROM `reminders` 
09-16 19:26:41.726: W/System.err(13495):    at com.j256.ormlite.misc.SqlExceptionUtil.create(SqlExceptionUtil.java:22)
09-16 19:26:41.726: W/System.err(13495):    at com.j256.ormlite.android.AndroidCompiledStatement.getCursor(AndroidCompiledStatement.java:158)
09-16 19:26:41.726: W/System.err(13495):    at com.j256.ormlite.android.AndroidCompiledStatement.runQuery(AndroidCompiledStatement.java:57)
09-16 19:26:41.726: W/System.err(13495):    at com.j256.ormlite.stmt.SelectIterator.<init>(SelectIterator.java:55)
09-16 19:26:41.726: W/System.err(13495):    at com.j256.ormlite.stmt.StatementExecutor.buildIterator(StatementExecutor.java:206)
09-16 19:26:41.726: W/System.err(13495):    at com.j256.ormlite.stmt.StatementExecutor.query(StatementExecutor.java:155)
09-16 19:26:41.726: W/System.err(13495):    at com.j256.ormlite.stmt.StatementExecutor.queryForAll(StatementExecutor.java:113)
09-16 19:26:41.726: W/System.err(13495):    at com.j256.ormlite.dao.BaseDaoImpl.queryForAll(BaseDaoImpl.java:237)
09-16 19:26:41.726: W/System.err(13495):    at com.library.FrequentlyUsedMethods.getDisplayReminders(FrequentlyUsedMethods.java:225)
09-16 19:26:41.726: W/System.err(13495):    at com.tempcontacts.CalendarHoursViewActivity$GridCellAdapter.getView(CalendarHoursViewActivity.java:386)
09-16 19:26:41.726: W/System.err(13495):    at android.widget.AbsListView.obtainView(AbsListView.java:2159)
09-16 19:26:41.726: W/System.err(13495):    at android.widget.GridView.makeAndAddView(GridView.java:1341)
09-16 19:26:41.726: W/System.err(13495):    at android.widget.GridView.makeRow(GridView.java:341)
09-16 19:26:41.726: W/System.err(13495):    at android.widget.GridView.fillDown(GridView.java:283)
09-16 19:26:41.726: W/System.err(13495):    at android.widget.GridView.fillFromTop(GridView.java:417)
09-16 19:26:41.726: W/System.err(13495):    at android.widget.GridView.layoutChildren(GridView.java:1229)
09-16 19:26:41.726: W/System.err(13495):    at android.widget.AbsListView.onLayout(AbsListView.java:1994)
09-16 19:26:41.726: W/System.err(13495):    at android.view.View.layout(View.java:14008)
09-16 19:26:41.736: W/System.err(13495):    at android.view.ViewGroup.layout(ViewGroup.java:4373)
09-16 19:26:41.736: W/System.err(13495):    at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1663)
09-16 19:26:41.736: W/System.err(13495):    at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1521)

此方法会导致此问题:

public ArrayList<ReminderItem> getDisplayReminders(Context context)
    {   
        ArrayList<ReminderItem> contactsList = null;
        DatabaseHandler db = new DatabaseHandler(getContext().getApplicationContext());
         try {
             db.getWritableDatabase();
            Dao<ReminderItem,Integer> daoSubject = db.getReminderDao();
            contactsList = (ArrayList<ReminderItem>) daoSubject.queryForAll();
         }
         catch(Exception e)
         {
             e.printStackTrace();
         }
        return contactsList;

    }

当我尝试从数据库中获取对象的 ArrayList 时。

格雷,请帮忙。

4

0 回答 0