Greetings Devs:

I'm looking for some help regarding an application I'm building that
uses a SQLite DB. I build the DB once on start up and fill a single
table with a few records. Then when I launch another activity to bind
the records to a listview I throw an SQLite Exception before I can
execute the query and I'm not sure why... Any ides?

Thanks so much and happy holidays to all!
-Michael

:::Logcat:::

12-21 15:37:52.604: ERROR/Database(522): sqlite3_open_v2
("icontrol.s3db", &handle, 2, NULL) failed

12-21 15:37:52.614: ERROR/SAMPLE_QUERY(522):
android.database.sqlite.SQLiteException: unable to open database file


Here is what I used to create the DB:

        SQLiteDatabase icontrol;
        icontrol = openOrCreateDatabase("icontrol.s3db",
SQLiteDatabase.CREATE_IF_NECESSARY,null);


        icontrol.setLocale(Locale.getDefault());
        icontrol.setLockingEnabled(true);
        icontrol.setVersion(DB_VERSION);

        //Create t_color
        icontrol.execSQL(CREATE_COLOR_TABLE);

        Log.i(DEBUG_TAG, "Got here...");

        //Close DB
        icontrol.close();


Here is what I used to query:

public void sampleQuery(){

        SQLiteDatabase icontrol;

        icontrol = SQLiteDatabase.openDatabase("icontrol.s3db", null,
SQLiteDatabase.OPEN_READWRITE);

        //Test Query: SELECT * FROM t_color
        Cursor c = icontrol.query
("t_color",null,null,null,null,null,null);

        startManagingCursor(c);

        ListAdapter adapter = new SimpleCursorAdapter(this,
R.layout.manage_items, c, new String[] { "color" }, new int[]
{R.id.TextView02});

        ((ListView)findViewById(R.id.ListView01)).setAdapter(adapter);
    }

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to