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 {
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("create table logins (username text primary key,"
+ "password text not null"
+");");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS logins");
onCreate(db);
}
}
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);
}
...
}

