Error Code:1 (SQLITE_ERROR) Caused By : SQL(query) error or missing databaseWrong ordering in generated table in jpaAndroid SQL Database - rawQuery() Source not FoundWhy does my exception handler not trap Android SQLite insert error?Loadmanager onLoadFinished not calledHow to transfer Downloaded JSONArray to a Database?android: SQL(query) error or missing database. (near “0”: syntax error (code 1): , while compiling:Error Code : 1 (SQLITE_ERROR) AndroidError Code : 1 (SQLITE_ERROR) Caused By : SQL(query) error or missing databaseJavaFX: update tableview context by selected combobox(binding)When i call an item from SQLite Database by its id, “SQLiteDatabase db = this.getReadableDatabase()” causes error: a null object reference

Unexpected behavior of the procedure `Area` on the object 'Polygon'

Can a stoichiometric mixture of oxygen and methane exist as a liquid at standard pressure and some (low) temperature?

Does an advisor owe his/her student anything? Will an advisor keep a PhD student only out of pity?

What is the evidence for the "tyranny of the majority problem" in a direct democracy context?

Does Doodling or Improvising on the Piano Have Any Benefits?

Lowest total scrabble score

Temporarily disable WLAN internet access for children, but allow it for adults

What should you do if you miss a job interview (deliberately)?

Does IPv6 have similar concept of network mask?

How do you make your own symbol when Detexify fails?

Plot of a tornado-shaped surface

Need help understanding what a natural log transformation is actually doing and why specific transformations are required for linear regression

Mimic lecturing on blackboard, facing audience

How could a planet have erratic days?

Using substitution ciphers to generate new alphabets in a novel

On a tidally locked planet, would time be quantized?

What exact color does ozone gas have?

Can I say "fingers" when referring to toes?

What are some good ways to treat frozen vegetables such that they behave like fresh vegetables when stir frying them?

Strong empirical falsification of quantum mechanics based on vacuum energy density

PTIJ: Haman's bad computer

How to cover method return statement in Apex Class?

Why should universal income be universal?

How does the math work for Perception checks?



Error Code:1 (SQLITE_ERROR) Caused By : SQL(query) error or missing database


Wrong ordering in generated table in jpaAndroid SQL Database - rawQuery() Source not FoundWhy does my exception handler not trap Android SQLite insert error?Loadmanager onLoadFinished not calledHow to transfer Downloaded JSONArray to a Database?android: SQL(query) error or missing database. (near “0”: syntax error (code 1): , while compiling:Error Code : 1 (SQLITE_ERROR) AndroidError Code : 1 (SQLITE_ERROR) Caused By : SQL(query) error or missing databaseJavaFX: update tableview context by selected combobox(binding)When i call an item from SQLite Database by its id, “SQLiteDatabase db = this.getReadableDatabase()” causes error: a null object reference













0















This is my Database Helper class and I getting Error This is y console



" Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6) "
Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6)

Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6)

Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6)

Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6)

Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6) Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6) Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6)

Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6) Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6)



Anyone PLease Help






public class DatabaseHelper extends SQLiteOpenHelper 



private static String DB_NAME = "ocinator.db";
private static String DB_PATH = "";
private static final int DB_VERSION = 8;

private SQLiteDatabase mDataBase;
private final Context mContext;
private boolean mNeedUpdate = false;

static final String PROFILE_TABLE = "CREATE TABLE profile (" +
" id_profile INTEGER PRIMARY KEY AUTOINCREMENT," +
" first_name VARCHAR (15)," +
" last_name VARCHAR (15)," +
" email VARCHAR (50)," +
" phone VARCHAR (30)," +
" login_status VARCHAR (20)," +
" username VARCHAR (30)," +
" password TEXT," +
" ocinator_id DOUBLE," +
" name VARCHAR (39)," +
" nickname VARCHAR (30)," +
" registered_date DATETIME" +
");";


static final String NOTIFICATIONS_TABLE = "CREATE TABLE notification_oc (" +
" notification_id INTEGER PRIMARY KEY AUTOINCREMENT," +
" notification_title TEXT," +
" notification_message TEXT," +
" notification_firetime DATETIME," +
" notification_creationtime DATETIME DEFAULT (CURRENT_TIMESTAMP)," +
" notification_status TEXT" +
");" ;



/**
* Constructor
* Takes and keeps a reference of the passed context in order to access to the application assets and resources.
* @param context
*/
public DatabaseHelper(Context context)
super(context, DB_NAME, null, DB_VERSION);
if (android.os.Build.VERSION.SDK_INT >= 17)
DB_PATH = context.getApplicationInfo().dataDir + "/databases/";
else
DB_PATH = "/data/data/" + context.getPackageName() + "/databases/";
this.mContext = context;

copyDataBase();

this.getReadableDatabase();


public void updateDataBase() throws IOException
if (mNeedUpdate)
File dbFile = new File(DB_PATH + DB_NAME);
if (dbFile.exists())
dbFile.delete();

copyDataBase();

mNeedUpdate = false;



private boolean checkDataBase()
File dbFile = new File(DB_PATH + DB_NAME);
return dbFile.exists();


private void copyDataBase()
if (!checkDataBase())
this.getReadableDatabase();
this.close();
try
copyDBFile();
catch (IOException mIOException)
throw new Error("ErrorCopyingDataBase");






private void copyDBFile() throws IOException

System.out.println("Input xx started");
InputStream mInput = mContext.getAssets().open(DB_NAME);
//InputStream mInput = mContext.getResources().openRawResource(R.raw.info);
OutputStream mOutput = new FileOutputStream(DB_PATH + DB_NAME);
byte[] mBuffer = new byte[1024];
int mLength;
while ((mLength = mInput.read(mBuffer)) > 0)
mOutput.write(mBuffer, 0, mLength);
mOutput.flush();
mOutput.close();
mInput.close();


public boolean openDataBase() throws SQLException
mDataBase = SQLiteDatabase.openDatabase(DB_PATH + DB_NAME, null, SQLiteDatabase.CREATE_IF_NECESSARY);
return mDataBase != null;


@Override
public synchronized void close()
if (mDataBase != null)
mDataBase.close();
super.close();


@Override
public void onCreate(SQLiteDatabase db)

// db.execSQL(PROFILE_TABLE);
// db.execSQL(NOTIFICATIONS_TABLE);



@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
if (newVersion > oldVersion)
mNeedUpdate = true;

// db.execSQL("DROP TABLE IF EXISTS profile");
// db.execSQL("DROP TABLE IF EXISTS notification_oc");
// onCreate(db);






public boolean insertNotification (String title, String msg, String time, String status)
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put("notification_title", title);
contentValues.put("notification_message", msg);
contentValues.put("notification_firetime", time);
contentValues.put("notification_status", status);
db.insert("notification_oc", null, contentValues);
return true;


public ArrayList<String> getAllNotifications()
ArrayList<String> array_list = new ArrayList<String>();

//hp = new HashMap();
SQLiteDatabase db = this.getReadableDatabase();
Cursor res = db.rawQuery( "select * from notification_oc", null );
res.moveToFirst();

while(res.isAfterLast() == false)
array_list.add(res.getString(res.getColumnIndex("notification_title")));
res.moveToNext();

return array_list;


public Cursor getNotification(int id)
SQLiteDatabase db = this.getReadableDatabase();
Cursor res = db.rawQuery( "select * from notification_oc where notification_id="+id+"", null );
return res;


public int numberOfRowsInNotifications()
SQLiteDatabase db = this.getReadableDatabase();
int numRows = (int) DatabaseUtils.queryNumEntries(db, "notification_oc");
return numRows;



public Integer deleteNotification (Integer id)
SQLiteDatabase db = this.getWritableDatabase();
return db.delete("notification_oc",
"notification_id = ? ",
new String[] Integer.toString(id) );





public boolean insertUser (String username, String password, String nickname, String email)
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put("username", username);
contentValues.put("password", password);
contentValues.put("nickname", nickname);
contentValues.put("email", email);
db.insert("profile", null, contentValues);
return true;



public Integer deleteUser (Integer id)
SQLiteDatabase db = this.getWritableDatabase();
return db.delete("profile",
"id_profile = ? ",
new String[] Integer.toString(id) );


public Cursor getUser(int id)

SQLiteDatabase db = this.getReadableDatabase();
System.out.println("USERNAMEX1 : 111" );
Cursor res = db.rawQuery( "select * from profile where id_profile="+id+"", null );
System.out.println("USERNAMEX2 : 222" );
return res;


// Add your public helper methods to access and get content from the database.
// You could return cursors by doing "return myDataBase.query(....)" so it'd be easy
// to you to create adapters for your views.













share|improve this question






















  • What is db version in the file you copy? is it same as 8?

    – AIMIN PAN
    Mar 8 at 3:44











  • Yes it is same but I have also tried after change it

    – Shivam sehrawat
    Mar 9 at 17:03















0















This is my Database Helper class and I getting Error This is y console



" Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6) "
Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6)

Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6)

Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6)

Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6)

Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6) Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6) Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6)

Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6) Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6)



Anyone PLease Help






public class DatabaseHelper extends SQLiteOpenHelper 



private static String DB_NAME = "ocinator.db";
private static String DB_PATH = "";
private static final int DB_VERSION = 8;

private SQLiteDatabase mDataBase;
private final Context mContext;
private boolean mNeedUpdate = false;

static final String PROFILE_TABLE = "CREATE TABLE profile (" +
" id_profile INTEGER PRIMARY KEY AUTOINCREMENT," +
" first_name VARCHAR (15)," +
" last_name VARCHAR (15)," +
" email VARCHAR (50)," +
" phone VARCHAR (30)," +
" login_status VARCHAR (20)," +
" username VARCHAR (30)," +
" password TEXT," +
" ocinator_id DOUBLE," +
" name VARCHAR (39)," +
" nickname VARCHAR (30)," +
" registered_date DATETIME" +
");";


static final String NOTIFICATIONS_TABLE = "CREATE TABLE notification_oc (" +
" notification_id INTEGER PRIMARY KEY AUTOINCREMENT," +
" notification_title TEXT," +
" notification_message TEXT," +
" notification_firetime DATETIME," +
" notification_creationtime DATETIME DEFAULT (CURRENT_TIMESTAMP)," +
" notification_status TEXT" +
");" ;



/**
* Constructor
* Takes and keeps a reference of the passed context in order to access to the application assets and resources.
* @param context
*/
public DatabaseHelper(Context context)
super(context, DB_NAME, null, DB_VERSION);
if (android.os.Build.VERSION.SDK_INT >= 17)
DB_PATH = context.getApplicationInfo().dataDir + "/databases/";
else
DB_PATH = "/data/data/" + context.getPackageName() + "/databases/";
this.mContext = context;

copyDataBase();

this.getReadableDatabase();


public void updateDataBase() throws IOException
if (mNeedUpdate)
File dbFile = new File(DB_PATH + DB_NAME);
if (dbFile.exists())
dbFile.delete();

copyDataBase();

mNeedUpdate = false;



private boolean checkDataBase()
File dbFile = new File(DB_PATH + DB_NAME);
return dbFile.exists();


private void copyDataBase()
if (!checkDataBase())
this.getReadableDatabase();
this.close();
try
copyDBFile();
catch (IOException mIOException)
throw new Error("ErrorCopyingDataBase");






private void copyDBFile() throws IOException

System.out.println("Input xx started");
InputStream mInput = mContext.getAssets().open(DB_NAME);
//InputStream mInput = mContext.getResources().openRawResource(R.raw.info);
OutputStream mOutput = new FileOutputStream(DB_PATH + DB_NAME);
byte[] mBuffer = new byte[1024];
int mLength;
while ((mLength = mInput.read(mBuffer)) > 0)
mOutput.write(mBuffer, 0, mLength);
mOutput.flush();
mOutput.close();
mInput.close();


public boolean openDataBase() throws SQLException
mDataBase = SQLiteDatabase.openDatabase(DB_PATH + DB_NAME, null, SQLiteDatabase.CREATE_IF_NECESSARY);
return mDataBase != null;


@Override
public synchronized void close()
if (mDataBase != null)
mDataBase.close();
super.close();


@Override
public void onCreate(SQLiteDatabase db)

// db.execSQL(PROFILE_TABLE);
// db.execSQL(NOTIFICATIONS_TABLE);



@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
if (newVersion > oldVersion)
mNeedUpdate = true;

// db.execSQL("DROP TABLE IF EXISTS profile");
// db.execSQL("DROP TABLE IF EXISTS notification_oc");
// onCreate(db);






public boolean insertNotification (String title, String msg, String time, String status)
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put("notification_title", title);
contentValues.put("notification_message", msg);
contentValues.put("notification_firetime", time);
contentValues.put("notification_status", status);
db.insert("notification_oc", null, contentValues);
return true;


public ArrayList<String> getAllNotifications()
ArrayList<String> array_list = new ArrayList<String>();

//hp = new HashMap();
SQLiteDatabase db = this.getReadableDatabase();
Cursor res = db.rawQuery( "select * from notification_oc", null );
res.moveToFirst();

while(res.isAfterLast() == false)
array_list.add(res.getString(res.getColumnIndex("notification_title")));
res.moveToNext();

return array_list;


public Cursor getNotification(int id)
SQLiteDatabase db = this.getReadableDatabase();
Cursor res = db.rawQuery( "select * from notification_oc where notification_id="+id+"", null );
return res;


public int numberOfRowsInNotifications()
SQLiteDatabase db = this.getReadableDatabase();
int numRows = (int) DatabaseUtils.queryNumEntries(db, "notification_oc");
return numRows;



public Integer deleteNotification (Integer id)
SQLiteDatabase db = this.getWritableDatabase();
return db.delete("notification_oc",
"notification_id = ? ",
new String[] Integer.toString(id) );





public boolean insertUser (String username, String password, String nickname, String email)
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put("username", username);
contentValues.put("password", password);
contentValues.put("nickname", nickname);
contentValues.put("email", email);
db.insert("profile", null, contentValues);
return true;



public Integer deleteUser (Integer id)
SQLiteDatabase db = this.getWritableDatabase();
return db.delete("profile",
"id_profile = ? ",
new String[] Integer.toString(id) );


public Cursor getUser(int id)

SQLiteDatabase db = this.getReadableDatabase();
System.out.println("USERNAMEX1 : 111" );
Cursor res = db.rawQuery( "select * from profile where id_profile="+id+"", null );
System.out.println("USERNAMEX2 : 222" );
return res;


// Add your public helper methods to access and get content from the database.
// You could return cursors by doing "return myDataBase.query(....)" so it'd be easy
// to you to create adapters for your views.













share|improve this question






















  • What is db version in the file you copy? is it same as 8?

    – AIMIN PAN
    Mar 8 at 3:44











  • Yes it is same but I have also tried after change it

    – Shivam sehrawat
    Mar 9 at 17:03













0












0








0








This is my Database Helper class and I getting Error This is y console



" Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6) "
Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6)

Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6)

Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6)

Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6)

Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6) Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6) Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6)

Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6) Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6)



Anyone PLease Help






public class DatabaseHelper extends SQLiteOpenHelper 



private static String DB_NAME = "ocinator.db";
private static String DB_PATH = "";
private static final int DB_VERSION = 8;

private SQLiteDatabase mDataBase;
private final Context mContext;
private boolean mNeedUpdate = false;

static final String PROFILE_TABLE = "CREATE TABLE profile (" +
" id_profile INTEGER PRIMARY KEY AUTOINCREMENT," +
" first_name VARCHAR (15)," +
" last_name VARCHAR (15)," +
" email VARCHAR (50)," +
" phone VARCHAR (30)," +
" login_status VARCHAR (20)," +
" username VARCHAR (30)," +
" password TEXT," +
" ocinator_id DOUBLE," +
" name VARCHAR (39)," +
" nickname VARCHAR (30)," +
" registered_date DATETIME" +
");";


static final String NOTIFICATIONS_TABLE = "CREATE TABLE notification_oc (" +
" notification_id INTEGER PRIMARY KEY AUTOINCREMENT," +
" notification_title TEXT," +
" notification_message TEXT," +
" notification_firetime DATETIME," +
" notification_creationtime DATETIME DEFAULT (CURRENT_TIMESTAMP)," +
" notification_status TEXT" +
");" ;



/**
* Constructor
* Takes and keeps a reference of the passed context in order to access to the application assets and resources.
* @param context
*/
public DatabaseHelper(Context context)
super(context, DB_NAME, null, DB_VERSION);
if (android.os.Build.VERSION.SDK_INT >= 17)
DB_PATH = context.getApplicationInfo().dataDir + "/databases/";
else
DB_PATH = "/data/data/" + context.getPackageName() + "/databases/";
this.mContext = context;

copyDataBase();

this.getReadableDatabase();


public void updateDataBase() throws IOException
if (mNeedUpdate)
File dbFile = new File(DB_PATH + DB_NAME);
if (dbFile.exists())
dbFile.delete();

copyDataBase();

mNeedUpdate = false;



private boolean checkDataBase()
File dbFile = new File(DB_PATH + DB_NAME);
return dbFile.exists();


private void copyDataBase()
if (!checkDataBase())
this.getReadableDatabase();
this.close();
try
copyDBFile();
catch (IOException mIOException)
throw new Error("ErrorCopyingDataBase");






private void copyDBFile() throws IOException

System.out.println("Input xx started");
InputStream mInput = mContext.getAssets().open(DB_NAME);
//InputStream mInput = mContext.getResources().openRawResource(R.raw.info);
OutputStream mOutput = new FileOutputStream(DB_PATH + DB_NAME);
byte[] mBuffer = new byte[1024];
int mLength;
while ((mLength = mInput.read(mBuffer)) > 0)
mOutput.write(mBuffer, 0, mLength);
mOutput.flush();
mOutput.close();
mInput.close();


public boolean openDataBase() throws SQLException
mDataBase = SQLiteDatabase.openDatabase(DB_PATH + DB_NAME, null, SQLiteDatabase.CREATE_IF_NECESSARY);
return mDataBase != null;


@Override
public synchronized void close()
if (mDataBase != null)
mDataBase.close();
super.close();


@Override
public void onCreate(SQLiteDatabase db)

// db.execSQL(PROFILE_TABLE);
// db.execSQL(NOTIFICATIONS_TABLE);



@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
if (newVersion > oldVersion)
mNeedUpdate = true;

// db.execSQL("DROP TABLE IF EXISTS profile");
// db.execSQL("DROP TABLE IF EXISTS notification_oc");
// onCreate(db);






public boolean insertNotification (String title, String msg, String time, String status)
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put("notification_title", title);
contentValues.put("notification_message", msg);
contentValues.put("notification_firetime", time);
contentValues.put("notification_status", status);
db.insert("notification_oc", null, contentValues);
return true;


public ArrayList<String> getAllNotifications()
ArrayList<String> array_list = new ArrayList<String>();

//hp = new HashMap();
SQLiteDatabase db = this.getReadableDatabase();
Cursor res = db.rawQuery( "select * from notification_oc", null );
res.moveToFirst();

while(res.isAfterLast() == false)
array_list.add(res.getString(res.getColumnIndex("notification_title")));
res.moveToNext();

return array_list;


public Cursor getNotification(int id)
SQLiteDatabase db = this.getReadableDatabase();
Cursor res = db.rawQuery( "select * from notification_oc where notification_id="+id+"", null );
return res;


public int numberOfRowsInNotifications()
SQLiteDatabase db = this.getReadableDatabase();
int numRows = (int) DatabaseUtils.queryNumEntries(db, "notification_oc");
return numRows;



public Integer deleteNotification (Integer id)
SQLiteDatabase db = this.getWritableDatabase();
return db.delete("notification_oc",
"notification_id = ? ",
new String[] Integer.toString(id) );





public boolean insertUser (String username, String password, String nickname, String email)
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put("username", username);
contentValues.put("password", password);
contentValues.put("nickname", nickname);
contentValues.put("email", email);
db.insert("profile", null, contentValues);
return true;



public Integer deleteUser (Integer id)
SQLiteDatabase db = this.getWritableDatabase();
return db.delete("profile",
"id_profile = ? ",
new String[] Integer.toString(id) );


public Cursor getUser(int id)

SQLiteDatabase db = this.getReadableDatabase();
System.out.println("USERNAMEX1 : 111" );
Cursor res = db.rawQuery( "select * from profile where id_profile="+id+"", null );
System.out.println("USERNAMEX2 : 222" );
return res;


// Add your public helper methods to access and get content from the database.
// You could return cursors by doing "return myDataBase.query(....)" so it'd be easy
// to you to create adapters for your views.













share|improve this question














This is my Database Helper class and I getting Error This is y console



" Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6) "
Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6)

Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6)

Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6)

Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6)

Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6) Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6) Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6)

Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6) Caused By : SQL(query) error or missing database. (no such table: profile (code 1): , while compiling: select * from profile where id_profile=6)



Anyone PLease Help






public class DatabaseHelper extends SQLiteOpenHelper 



private static String DB_NAME = "ocinator.db";
private static String DB_PATH = "";
private static final int DB_VERSION = 8;

private SQLiteDatabase mDataBase;
private final Context mContext;
private boolean mNeedUpdate = false;

static final String PROFILE_TABLE = "CREATE TABLE profile (" +
" id_profile INTEGER PRIMARY KEY AUTOINCREMENT," +
" first_name VARCHAR (15)," +
" last_name VARCHAR (15)," +
" email VARCHAR (50)," +
" phone VARCHAR (30)," +
" login_status VARCHAR (20)," +
" username VARCHAR (30)," +
" password TEXT," +
" ocinator_id DOUBLE," +
" name VARCHAR (39)," +
" nickname VARCHAR (30)," +
" registered_date DATETIME" +
");";


static final String NOTIFICATIONS_TABLE = "CREATE TABLE notification_oc (" +
" notification_id INTEGER PRIMARY KEY AUTOINCREMENT," +
" notification_title TEXT," +
" notification_message TEXT," +
" notification_firetime DATETIME," +
" notification_creationtime DATETIME DEFAULT (CURRENT_TIMESTAMP)," +
" notification_status TEXT" +
");" ;



/**
* Constructor
* Takes and keeps a reference of the passed context in order to access to the application assets and resources.
* @param context
*/
public DatabaseHelper(Context context)
super(context, DB_NAME, null, DB_VERSION);
if (android.os.Build.VERSION.SDK_INT >= 17)
DB_PATH = context.getApplicationInfo().dataDir + "/databases/";
else
DB_PATH = "/data/data/" + context.getPackageName() + "/databases/";
this.mContext = context;

copyDataBase();

this.getReadableDatabase();


public void updateDataBase() throws IOException
if (mNeedUpdate)
File dbFile = new File(DB_PATH + DB_NAME);
if (dbFile.exists())
dbFile.delete();

copyDataBase();

mNeedUpdate = false;



private boolean checkDataBase()
File dbFile = new File(DB_PATH + DB_NAME);
return dbFile.exists();


private void copyDataBase()
if (!checkDataBase())
this.getReadableDatabase();
this.close();
try
copyDBFile();
catch (IOException mIOException)
throw new Error("ErrorCopyingDataBase");






private void copyDBFile() throws IOException

System.out.println("Input xx started");
InputStream mInput = mContext.getAssets().open(DB_NAME);
//InputStream mInput = mContext.getResources().openRawResource(R.raw.info);
OutputStream mOutput = new FileOutputStream(DB_PATH + DB_NAME);
byte[] mBuffer = new byte[1024];
int mLength;
while ((mLength = mInput.read(mBuffer)) > 0)
mOutput.write(mBuffer, 0, mLength);
mOutput.flush();
mOutput.close();
mInput.close();


public boolean openDataBase() throws SQLException
mDataBase = SQLiteDatabase.openDatabase(DB_PATH + DB_NAME, null, SQLiteDatabase.CREATE_IF_NECESSARY);
return mDataBase != null;


@Override
public synchronized void close()
if (mDataBase != null)
mDataBase.close();
super.close();


@Override
public void onCreate(SQLiteDatabase db)

// db.execSQL(PROFILE_TABLE);
// db.execSQL(NOTIFICATIONS_TABLE);



@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
if (newVersion > oldVersion)
mNeedUpdate = true;

// db.execSQL("DROP TABLE IF EXISTS profile");
// db.execSQL("DROP TABLE IF EXISTS notification_oc");
// onCreate(db);






public boolean insertNotification (String title, String msg, String time, String status)
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put("notification_title", title);
contentValues.put("notification_message", msg);
contentValues.put("notification_firetime", time);
contentValues.put("notification_status", status);
db.insert("notification_oc", null, contentValues);
return true;


public ArrayList<String> getAllNotifications()
ArrayList<String> array_list = new ArrayList<String>();

//hp = new HashMap();
SQLiteDatabase db = this.getReadableDatabase();
Cursor res = db.rawQuery( "select * from notification_oc", null );
res.moveToFirst();

while(res.isAfterLast() == false)
array_list.add(res.getString(res.getColumnIndex("notification_title")));
res.moveToNext();

return array_list;


public Cursor getNotification(int id)
SQLiteDatabase db = this.getReadableDatabase();
Cursor res = db.rawQuery( "select * from notification_oc where notification_id="+id+"", null );
return res;


public int numberOfRowsInNotifications()
SQLiteDatabase db = this.getReadableDatabase();
int numRows = (int) DatabaseUtils.queryNumEntries(db, "notification_oc");
return numRows;



public Integer deleteNotification (Integer id)
SQLiteDatabase db = this.getWritableDatabase();
return db.delete("notification_oc",
"notification_id = ? ",
new String[] Integer.toString(id) );





public boolean insertUser (String username, String password, String nickname, String email)
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put("username", username);
contentValues.put("password", password);
contentValues.put("nickname", nickname);
contentValues.put("email", email);
db.insert("profile", null, contentValues);
return true;



public Integer deleteUser (Integer id)
SQLiteDatabase db = this.getWritableDatabase();
return db.delete("profile",
"id_profile = ? ",
new String[] Integer.toString(id) );


public Cursor getUser(int id)

SQLiteDatabase db = this.getReadableDatabase();
System.out.println("USERNAMEX1 : 111" );
Cursor res = db.rawQuery( "select * from profile where id_profile="+id+"", null );
System.out.println("USERNAMEX2 : 222" );
return res;


// Add your public helper methods to access and get content from the database.
// You could return cursors by doing "return myDataBase.query(....)" so it'd be easy
// to you to create adapters for your views.









public class DatabaseHelper extends SQLiteOpenHelper 



private static String DB_NAME = "ocinator.db";
private static String DB_PATH = "";
private static final int DB_VERSION = 8;

private SQLiteDatabase mDataBase;
private final Context mContext;
private boolean mNeedUpdate = false;

static final String PROFILE_TABLE = "CREATE TABLE profile (" +
" id_profile INTEGER PRIMARY KEY AUTOINCREMENT," +
" first_name VARCHAR (15)," +
" last_name VARCHAR (15)," +
" email VARCHAR (50)," +
" phone VARCHAR (30)," +
" login_status VARCHAR (20)," +
" username VARCHAR (30)," +
" password TEXT," +
" ocinator_id DOUBLE," +
" name VARCHAR (39)," +
" nickname VARCHAR (30)," +
" registered_date DATETIME" +
");";


static final String NOTIFICATIONS_TABLE = "CREATE TABLE notification_oc (" +
" notification_id INTEGER PRIMARY KEY AUTOINCREMENT," +
" notification_title TEXT," +
" notification_message TEXT," +
" notification_firetime DATETIME," +
" notification_creationtime DATETIME DEFAULT (CURRENT_TIMESTAMP)," +
" notification_status TEXT" +
");" ;



/**
* Constructor
* Takes and keeps a reference of the passed context in order to access to the application assets and resources.
* @param context
*/
public DatabaseHelper(Context context)
super(context, DB_NAME, null, DB_VERSION);
if (android.os.Build.VERSION.SDK_INT >= 17)
DB_PATH = context.getApplicationInfo().dataDir + "/databases/";
else
DB_PATH = "/data/data/" + context.getPackageName() + "/databases/";
this.mContext = context;

copyDataBase();

this.getReadableDatabase();


public void updateDataBase() throws IOException
if (mNeedUpdate)
File dbFile = new File(DB_PATH + DB_NAME);
if (dbFile.exists())
dbFile.delete();

copyDataBase();

mNeedUpdate = false;



private boolean checkDataBase()
File dbFile = new File(DB_PATH + DB_NAME);
return dbFile.exists();


private void copyDataBase()
if (!checkDataBase())
this.getReadableDatabase();
this.close();
try
copyDBFile();
catch (IOException mIOException)
throw new Error("ErrorCopyingDataBase");






private void copyDBFile() throws IOException

System.out.println("Input xx started");
InputStream mInput = mContext.getAssets().open(DB_NAME);
//InputStream mInput = mContext.getResources().openRawResource(R.raw.info);
OutputStream mOutput = new FileOutputStream(DB_PATH + DB_NAME);
byte[] mBuffer = new byte[1024];
int mLength;
while ((mLength = mInput.read(mBuffer)) > 0)
mOutput.write(mBuffer, 0, mLength);
mOutput.flush();
mOutput.close();
mInput.close();


public boolean openDataBase() throws SQLException
mDataBase = SQLiteDatabase.openDatabase(DB_PATH + DB_NAME, null, SQLiteDatabase.CREATE_IF_NECESSARY);
return mDataBase != null;


@Override
public synchronized void close()
if (mDataBase != null)
mDataBase.close();
super.close();


@Override
public void onCreate(SQLiteDatabase db)

// db.execSQL(PROFILE_TABLE);
// db.execSQL(NOTIFICATIONS_TABLE);



@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
if (newVersion > oldVersion)
mNeedUpdate = true;

// db.execSQL("DROP TABLE IF EXISTS profile");
// db.execSQL("DROP TABLE IF EXISTS notification_oc");
// onCreate(db);






public boolean insertNotification (String title, String msg, String time, String status)
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put("notification_title", title);
contentValues.put("notification_message", msg);
contentValues.put("notification_firetime", time);
contentValues.put("notification_status", status);
db.insert("notification_oc", null, contentValues);
return true;


public ArrayList<String> getAllNotifications()
ArrayList<String> array_list = new ArrayList<String>();

//hp = new HashMap();
SQLiteDatabase db = this.getReadableDatabase();
Cursor res = db.rawQuery( "select * from notification_oc", null );
res.moveToFirst();

while(res.isAfterLast() == false)
array_list.add(res.getString(res.getColumnIndex("notification_title")));
res.moveToNext();

return array_list;


public Cursor getNotification(int id)
SQLiteDatabase db = this.getReadableDatabase();
Cursor res = db.rawQuery( "select * from notification_oc where notification_id="+id+"", null );
return res;


public int numberOfRowsInNotifications()
SQLiteDatabase db = this.getReadableDatabase();
int numRows = (int) DatabaseUtils.queryNumEntries(db, "notification_oc");
return numRows;



public Integer deleteNotification (Integer id)
SQLiteDatabase db = this.getWritableDatabase();
return db.delete("notification_oc",
"notification_id = ? ",
new String[] Integer.toString(id) );





public boolean insertUser (String username, String password, String nickname, String email)
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put("username", username);
contentValues.put("password", password);
contentValues.put("nickname", nickname);
contentValues.put("email", email);
db.insert("profile", null, contentValues);
return true;



public Integer deleteUser (Integer id)
SQLiteDatabase db = this.getWritableDatabase();
return db.delete("profile",
"id_profile = ? ",
new String[] Integer.toString(id) );


public Cursor getUser(int id)

SQLiteDatabase db = this.getReadableDatabase();
System.out.println("USERNAMEX1 : 111" );
Cursor res = db.rawQuery( "select * from profile where id_profile="+id+"", null );
System.out.println("USERNAMEX2 : 222" );
return res;


// Add your public helper methods to access and get content from the database.
// You could return cursors by doing "return myDataBase.query(....)" so it'd be easy
// to you to create adapters for your views.






public class DatabaseHelper extends SQLiteOpenHelper 



private static String DB_NAME = "ocinator.db";
private static String DB_PATH = "";
private static final int DB_VERSION = 8;

private SQLiteDatabase mDataBase;
private final Context mContext;
private boolean mNeedUpdate = false;

static final String PROFILE_TABLE = "CREATE TABLE profile (" +
" id_profile INTEGER PRIMARY KEY AUTOINCREMENT," +
" first_name VARCHAR (15)," +
" last_name VARCHAR (15)," +
" email VARCHAR (50)," +
" phone VARCHAR (30)," +
" login_status VARCHAR (20)," +
" username VARCHAR (30)," +
" password TEXT," +
" ocinator_id DOUBLE," +
" name VARCHAR (39)," +
" nickname VARCHAR (30)," +
" registered_date DATETIME" +
");";


static final String NOTIFICATIONS_TABLE = "CREATE TABLE notification_oc (" +
" notification_id INTEGER PRIMARY KEY AUTOINCREMENT," +
" notification_title TEXT," +
" notification_message TEXT," +
" notification_firetime DATETIME," +
" notification_creationtime DATETIME DEFAULT (CURRENT_TIMESTAMP)," +
" notification_status TEXT" +
");" ;



/**
* Constructor
* Takes and keeps a reference of the passed context in order to access to the application assets and resources.
* @param context
*/
public DatabaseHelper(Context context)
super(context, DB_NAME, null, DB_VERSION);
if (android.os.Build.VERSION.SDK_INT >= 17)
DB_PATH = context.getApplicationInfo().dataDir + "/databases/";
else
DB_PATH = "/data/data/" + context.getPackageName() + "/databases/";
this.mContext = context;

copyDataBase();

this.getReadableDatabase();


public void updateDataBase() throws IOException
if (mNeedUpdate)
File dbFile = new File(DB_PATH + DB_NAME);
if (dbFile.exists())
dbFile.delete();

copyDataBase();

mNeedUpdate = false;



private boolean checkDataBase()
File dbFile = new File(DB_PATH + DB_NAME);
return dbFile.exists();


private void copyDataBase()
if (!checkDataBase())
this.getReadableDatabase();
this.close();
try
copyDBFile();
catch (IOException mIOException)
throw new Error("ErrorCopyingDataBase");






private void copyDBFile() throws IOException

System.out.println("Input xx started");
InputStream mInput = mContext.getAssets().open(DB_NAME);
//InputStream mInput = mContext.getResources().openRawResource(R.raw.info);
OutputStream mOutput = new FileOutputStream(DB_PATH + DB_NAME);
byte[] mBuffer = new byte[1024];
int mLength;
while ((mLength = mInput.read(mBuffer)) > 0)
mOutput.write(mBuffer, 0, mLength);
mOutput.flush();
mOutput.close();
mInput.close();


public boolean openDataBase() throws SQLException
mDataBase = SQLiteDatabase.openDatabase(DB_PATH + DB_NAME, null, SQLiteDatabase.CREATE_IF_NECESSARY);
return mDataBase != null;


@Override
public synchronized void close()
if (mDataBase != null)
mDataBase.close();
super.close();


@Override
public void onCreate(SQLiteDatabase db)

// db.execSQL(PROFILE_TABLE);
// db.execSQL(NOTIFICATIONS_TABLE);



@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
if (newVersion > oldVersion)
mNeedUpdate = true;

// db.execSQL("DROP TABLE IF EXISTS profile");
// db.execSQL("DROP TABLE IF EXISTS notification_oc");
// onCreate(db);






public boolean insertNotification (String title, String msg, String time, String status)
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put("notification_title", title);
contentValues.put("notification_message", msg);
contentValues.put("notification_firetime", time);
contentValues.put("notification_status", status);
db.insert("notification_oc", null, contentValues);
return true;


public ArrayList<String> getAllNotifications()
ArrayList<String> array_list = new ArrayList<String>();

//hp = new HashMap();
SQLiteDatabase db = this.getReadableDatabase();
Cursor res = db.rawQuery( "select * from notification_oc", null );
res.moveToFirst();

while(res.isAfterLast() == false)
array_list.add(res.getString(res.getColumnIndex("notification_title")));
res.moveToNext();

return array_list;


public Cursor getNotification(int id)
SQLiteDatabase db = this.getReadableDatabase();
Cursor res = db.rawQuery( "select * from notification_oc where notification_id="+id+"", null );
return res;


public int numberOfRowsInNotifications()
SQLiteDatabase db = this.getReadableDatabase();
int numRows = (int) DatabaseUtils.queryNumEntries(db, "notification_oc");
return numRows;



public Integer deleteNotification (Integer id)
SQLiteDatabase db = this.getWritableDatabase();
return db.delete("notification_oc",
"notification_id = ? ",
new String[] Integer.toString(id) );





public boolean insertUser (String username, String password, String nickname, String email)
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put("username", username);
contentValues.put("password", password);
contentValues.put("nickname", nickname);
contentValues.put("email", email);
db.insert("profile", null, contentValues);
return true;



public Integer deleteUser (Integer id)
SQLiteDatabase db = this.getWritableDatabase();
return db.delete("profile",
"id_profile = ? ",
new String[] Integer.toString(id) );


public Cursor getUser(int id)

SQLiteDatabase db = this.getReadableDatabase();
System.out.println("USERNAMEX1 : 111" );
Cursor res = db.rawQuery( "select * from profile where id_profile="+id+"", null );
System.out.println("USERNAMEX2 : 222" );
return res;


// Add your public helper methods to access and get content from the database.
// You could return cursors by doing "return myDataBase.query(....)" so it'd be easy
// to you to create adapters for your views.







java android






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 8 at 2:05









Shivam sehrawatShivam sehrawat

14




14












  • What is db version in the file you copy? is it same as 8?

    – AIMIN PAN
    Mar 8 at 3:44











  • Yes it is same but I have also tried after change it

    – Shivam sehrawat
    Mar 9 at 17:03

















  • What is db version in the file you copy? is it same as 8?

    – AIMIN PAN
    Mar 8 at 3:44











  • Yes it is same but I have also tried after change it

    – Shivam sehrawat
    Mar 9 at 17:03
















What is db version in the file you copy? is it same as 8?

– AIMIN PAN
Mar 8 at 3:44





What is db version in the file you copy? is it same as 8?

– AIMIN PAN
Mar 8 at 3:44













Yes it is same but I have also tried after change it

– Shivam sehrawat
Mar 9 at 17:03





Yes it is same but I have also tried after change it

– Shivam sehrawat
Mar 9 at 17:03












1 Answer
1






active

oldest

votes


















0














You are using this for the database dir:



 if (android.os.Build.VERSION.SDK_INT >= 17)
DB_PATH = context.getApplicationInfo().dataDir + "/databases/";
else
DB_PATH = "/data/data/" + context.getPackageName() + "/databases/";


and then



 DB_PATH + DB_NAME


You should use this as copy destination.



 context.getDatabasePath() + "/" + DB_NAME


It seems problem is you copied to somewhere which is not dir for SQLiteOpenHelper. Though mDatabase is used to open the file after you copy, it is not what SQLiteOpenHelper will use, and SQLiteOpenHelper will use its own for getReadableDatabase and getWritableDatabase, which is not the copied one, and it does not have the table you want.






share|improve this answer






















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55055724%2ferror-code1-sqlite-error-caused-by-sqlquery-error-or-missing-database%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    You are using this for the database dir:



     if (android.os.Build.VERSION.SDK_INT >= 17)
    DB_PATH = context.getApplicationInfo().dataDir + "/databases/";
    else
    DB_PATH = "/data/data/" + context.getPackageName() + "/databases/";


    and then



     DB_PATH + DB_NAME


    You should use this as copy destination.



     context.getDatabasePath() + "/" + DB_NAME


    It seems problem is you copied to somewhere which is not dir for SQLiteOpenHelper. Though mDatabase is used to open the file after you copy, it is not what SQLiteOpenHelper will use, and SQLiteOpenHelper will use its own for getReadableDatabase and getWritableDatabase, which is not the copied one, and it does not have the table you want.






    share|improve this answer



























      0














      You are using this for the database dir:



       if (android.os.Build.VERSION.SDK_INT >= 17)
      DB_PATH = context.getApplicationInfo().dataDir + "/databases/";
      else
      DB_PATH = "/data/data/" + context.getPackageName() + "/databases/";


      and then



       DB_PATH + DB_NAME


      You should use this as copy destination.



       context.getDatabasePath() + "/" + DB_NAME


      It seems problem is you copied to somewhere which is not dir for SQLiteOpenHelper. Though mDatabase is used to open the file after you copy, it is not what SQLiteOpenHelper will use, and SQLiteOpenHelper will use its own for getReadableDatabase and getWritableDatabase, which is not the copied one, and it does not have the table you want.






      share|improve this answer

























        0












        0








        0







        You are using this for the database dir:



         if (android.os.Build.VERSION.SDK_INT >= 17)
        DB_PATH = context.getApplicationInfo().dataDir + "/databases/";
        else
        DB_PATH = "/data/data/" + context.getPackageName() + "/databases/";


        and then



         DB_PATH + DB_NAME


        You should use this as copy destination.



         context.getDatabasePath() + "/" + DB_NAME


        It seems problem is you copied to somewhere which is not dir for SQLiteOpenHelper. Though mDatabase is used to open the file after you copy, it is not what SQLiteOpenHelper will use, and SQLiteOpenHelper will use its own for getReadableDatabase and getWritableDatabase, which is not the copied one, and it does not have the table you want.






        share|improve this answer













        You are using this for the database dir:



         if (android.os.Build.VERSION.SDK_INT >= 17)
        DB_PATH = context.getApplicationInfo().dataDir + "/databases/";
        else
        DB_PATH = "/data/data/" + context.getPackageName() + "/databases/";


        and then



         DB_PATH + DB_NAME


        You should use this as copy destination.



         context.getDatabasePath() + "/" + DB_NAME


        It seems problem is you copied to somewhere which is not dir for SQLiteOpenHelper. Though mDatabase is used to open the file after you copy, it is not what SQLiteOpenHelper will use, and SQLiteOpenHelper will use its own for getReadableDatabase and getWritableDatabase, which is not the copied one, and it does not have the table you want.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 12 at 3:38









        AIMIN PANAIMIN PAN

        269210




        269210





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55055724%2ferror-code1-sqlite-error-caused-by-sqlquery-error-or-missing-database%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

            Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

            2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived