AhmeX
AhmeX

Reputation: 25

Android sqlite database error SQLiteException

i have error when i try to save in database it immediately crashes with the error SQLiteException: no such column. I'm stumped on what to do as SQLite is still very much a mystery to me.

Logcat:

03-29 01:04:29.823: E/SQLiteDatabase(23044): Error inserting ID=0 Y=15.085753686726093 X=26.93791172584063 description=Programmez pour Android nom=marker
03-29 01:04:29.823: E/SQLiteDatabase(23044): android.database.sqlite.SQLiteException: no such table: table_point: , while compiling: INSERT INTO table_point(ID,Y,X,description,nom) VALUES (?,?,?,?,?)
03-29 01:04:29.823: E/SQLiteDatabase(23044):    at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
03-29 01:04:29.823: E/SQLiteDatabase(23044):    at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:64)
03-29 01:04:29.823: E/SQLiteDatabase(23044):    at android.database.sqlite.SQLiteProgram.compileSql(SQLiteProgram.java:177)
03-29 01:04:29.823: E/SQLiteDatabase(23044):    at android.database.sqlite.SQLiteProgram.compileAndbindAllArgs(SQLiteProgram.java:395)
03-29 01:04:29.823: E/SQLiteDatabase(23044):    at android.database.sqlite.SQLiteStatement.acquireAndLock(SQLiteStatement.java:263)
03-29 01:04:29.823: E/SQLiteDatabase(23044):    at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:115)
03-29 01:04:29.823: E/SQLiteDatabase(23044):    at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1718)
03-29 01:04:29.823: E/SQLiteDatabase(23044):    at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1591)
03-29 01:04:29.823: E/SQLiteDatabase(23044):    at tn.pfe.ybn.sigl.database.PointBDD.insertPoint(PointBDD.java:61)

Upvotes: 0

Views: 139

Answers (1)

Mike M.
Mike M.

Reputation: 39201

Actually, your logcat says no such table. I believe this is because your onCreate() method is empty, so the table is never getting created. Update your code in DbManager as follows:

@Override
public void onCreate(SQLiteDatabase db)
{
    db.execSQL(CREATE_POINTS);
}

Also, you've got two different table names in your code. In DbManager:

private static final String TABLE_POINT = "point";

In PointBDD:

private static final String TABLE_POINT = "table_point";

Upvotes: 2

Related Questions