create db

General topics about the Android-Platform itself.
Coding issues please to the subforum right below.

create db

Postby mystic-d » Sun Apr 20, 2008 6:37 pm

im using the below code to create the database and its working fine, except that when im watching the LogCat i saw the error msg : "Failed to open database file "/data/data/com.myAPP/database/DB.db" - unable to open database file" (i saw this under the "E" (ERROR) section)
did i missed somthing ?

Code: Select all
public class DalForPassTable
   private static class DatabaseHelper extends SQLiteOpenHelper {

        public void onCreate(SQLiteDatabase db) {
               db.execSQL("create table logins (username text primary key,"
                       + "password text not null"

        public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
              db.execSQL("DROP TABLE IF EXISTS logins");

    private static final String DATABASE_NAME = "DB.db";
    private static String DATABASE_TABLE ="logins";
    private static final int DATABASE_VERSION = 1;
    private SQLiteDatabase db;
    DalForPassTable(Context ctx)
       DatabaseHelper dbHelper = new DatabaseHelper();
        db = dbHelper.openDatabase(ctx, DATABASE_NAME, null, DATABASE_VERSION);
Junior Developer
Junior Developer
Posts: 15
Joined: Thu Mar 20, 2008 1:29 am


Return to General

Who is online

Users browsing this forum: No registered users and 5 guests