Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9201835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:06:52+00:00 2026-06-17T23:06:52+00:00

I got an error on inserting data on my database. 01-28 20:59:06.277: I/Database(553): sqlite

  • 0

I got an error on inserting data on my database.

01-28 20:59:06.277: I/Database(553): sqlite returned: error code = 1, msg = table tableKo has no column named phone
01-28 20:59:06.309: E/Database(553): Error inserting phone= email= address= name=
01-28 20:59:06.309: E/Database(553): android.database.sqlite.SQLiteException: table tableKo has no column named phone: , while compiling: INSERT INTO tableKo(phone, email, address, name) VALUES(?, ?, ?, ?);
01-28 20:59:06.309: E/Database(553):    at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
01-28 20:59:06.309: E/Database(553):    at android.database.sqlite.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:91)
01-28 20:59:06.309: E/Database(553):    at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:64)
01-28 20:59:06.309: E/Database(553):    at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:80)
01-28 20:59:06.309: E/Database(553):    at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:36)
01-28 20:59:06.309: E/Database(553):    at android.database.sqlite.SQLiteDatabase.compileStatement(SQLiteDatabase.java:1145)
01-28 20:59:06.309: E/Database(553):    at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1536)
01-28 20:59:06.309: E/Database(553):    at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1410)
01-28 20:59:06.309: E/Database(553):    at com.example.databasetest.DBHandler.insertData(DBHandler.java:76)
01-28 20:59:06.309: E/Database(553):    at com.example.databasetest.MainActivity.saveButtonHandler(MainActivity.java:39)
01-28 20:59:06.309: E/Database(553):    at java.lang.reflect.Method.invokeNative(Native Method)
01-28 20:59:06.309: E/Database(553):    at java.lang.reflect.Method.invoke(Method.java:521)
01-28 20:59:06.309: E/Database(553):    at android.view.View$1.onClick(View.java:2067)
01-28 20:59:06.309: E/Database(553):    at android.view.View.performClick(View.java:2408)
01-28 20:59:06.309: E/Database(553):    at android.view.View$PerformClick.run(View.java:8816)
01-28 20:59:06.309: E/Database(553):    at android.os.Handler.handleCallback(Handler.java:587)
01-28 20:59:06.309: E/Database(553):    at android.os.Handler.dispatchMessage(Handler.java:92)
01-28 20:59:06.309: E/Database(553):    at android.os.Looper.loop(Looper.java:123)
01-28 20:59:06.309: E/Database(553):    at android.app.ActivityThread.main(ActivityThread.java:4627)
01-28 20:59:06.309: E/Database(553):    at java.lang.reflect.Method.invokeNative(Native Method)
01-28 20:59:06.309: E/Database(553):    at java.lang.reflect.Method.invoke(Method.java:521)
01-28 20:59:06.309: E/Database(553):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
01-28 20:59:06.309: E/Database(553):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
01-28 20:59:06.309: E/Database(553):    at dalvik.system.NativeStart.main(Native Method)

I use a separate class that extends SQLiteOpenHelper to handle my database. I already search on the internet to know how does my table don’t have the column names here is my code:
My main class

package com.example.databasetest;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;

public class MainActivity extends Activity {

    EditText nameET;
    EditText addressET;
    EditText phoneET;
    EditText emailET;

    String name;
    String address;
    String phone;
    String email;

    DBHandler handler;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        nameET = (EditText)findViewById(R.id.nameET);
        addressET = (EditText)findViewById(R.id.addressET);
        phoneET = (EditText)findViewById(R.id.phoneET);
        emailET = (EditText)findViewById(R.id.emailET);

        name = nameET.getText().toString();
        address = addressET.getText().toString();
        phone = phoneET.getText().toString();
        email = emailET.getText().toString();
        handler = new DBHandler(this);
    }
    public void saveButtonHandler(View v) { 
        handler.insertData(name, address, phone, email);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
}

and this is my database handler class

package com.example.databasetest;

import android.content.ContentValues;
import android.content.Context;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class DBHandler {

    public static final String TABLE_NAME = "tableKo";
    public static final String DATABASE_NAME = "databaseKo";
    private static final int DATABASE_VERSION = 1;
    private static final String TAG = "DBHandler";

    public static final String COL_ID = "_id";
    public static final String COL_NAME = "name";
    public static final String COL_ADDRESS = "address";
    public static final String COL_PHONE = "phone";
    public static final String COL_EMAIL = "email";

    private final Context context;
    private SQLiteDatabase db;
    private MySQLiteOpenHelper DBHelper;

    private static final String CREATE_DATABASE ="create table "
            + TABLE_NAME + "(" + COL_ID
            + " integer primary key, " + COL_NAME
            + " text not null, " + COL_ADDRESS + "text not null,"
            + COL_PHONE + "text not null," + COL_EMAIL + "text not null);";
    public DBHandler(Context ctx) {
        this.context = ctx;
        DBHelper = new MySQLiteOpenHelper(context);
    }
    private static class MySQLiteOpenHelper extends SQLiteOpenHelper{
        public MySQLiteOpenHelper(Context context) {
            super(context, DATABASE_NAME, null, DATABASE_VERSION);
        }
        @Override
        public void onCreate(SQLiteDatabase db) {
            // TODO Auto-generated method stub
            try {
                db.execSQL(CREATE_DATABASE);
              } catch (SQLException e) {
                e.printStackTrace();
              } 
        }

        @Override
        public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
            // TODO Auto-generated method stub
            Log.w(TAG, oldVersion + " to " + newVersion
                    + ", which will destroy all old data");
            db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
            onCreate(db);
        }

    }
    public DBHandler open() throws SQLException {
        db = DBHelper.getWritableDatabase();
        return this;
    }

    public void close() {
        DBHelper.close();
    }
    public void insertData (String name, String address, String phone, String email) {
        open();
        ContentValues values = new ContentValues();
        values.put(COL_NAME, name);
        values.put(COL_ADDRESS, address);
        values.put(COL_PHONE, phone);
        values.put(COL_EMAIL, email);

        db.insert(TABLE_NAME, null, values);
        //db.execSQL("Insert into " +TABLE_NAME+ " VALUES('"+COL_ID+"','"+name+"','"+address+"','"+phone+"','"+email+"');");
        db.close();
    }
}

What is wrong with my code? Thanks in advance for your help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T23:06:53+00:00Added an answer on June 17, 2026 at 11:06 pm

    you missed a space :

    instead of

    COL_PHONE + "text not null,"
    

    use

    COL_PHONE + " text not null,"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting the following error when inserting data into my oracle database. java.sql.SQLException:
I got table with 3 columns (Primary)id, type, name. I am inserting data into
I have got this example for inserting data into funsiontables... The code basically creates
I'm curious about the error I just got after inserting this data, like so:
I got error when I write this code @Html.X().ResourceManager() in view error message :
I got error Access Violation when the following code is execute : void NoAction()
I'm trying to shake a window, but got error mess in console. My code:
I've got a large transaction comprising of getting lots of data from database A,
I am trying to insert data in my sqlit database but I got android
I got a problem when inserting a data. When I click the add button

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.