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 8441079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:28:18+00:00 2026-06-10T08:28:18+00:00

I’m trying to insert some data into my SQLite database. But I keeo receiving

  • 0

I’m trying to insert some data into my SQLite database. But I keeo receiving an error code 1 saying that my column does not exist. Can someone help me please, Below is my code:

08-17 13:12:46.473: I/Database(13328): sqlite returned: error code = 1, msg = table login has no column named uid
08-17 13:12:46.503: E/Database(13328): Error inserting uid=502e7b90657ab1.86949026 created_at=2012-08-17 12:12:48 email=epaas name=hwheuu
08-17 13:12:46.503: E/Database(13328): android.database.sqlite.SQLiteException: table login has no column named uid: , while compiling: INSERT INTO login(uid, created_at, email, name) VALUES(?, ?, ?, ?);
08-17 13:12:46.503: E/Database(13328):  at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
08-17 13:12:46.503: E/Database(13328):  at android.database.sqlite.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:92)
08-17 13:12:46.503: E/Database(13328):  at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:65)
08-17 13:12:46.503: E/Database(13328):  at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:83)
08-17 13:12:46.503: E/Database(13328):  at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:41)
08-17 13:12:46.503: E/Database(13328):  at android.database.sqlite.SQLiteDatabase.compileStatement(SQLiteDatabase.java:1231)
08-17 13:12:46.503: E/Database(13328):  at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1658)
08-17 13:12:46.503: E/Database(13328):  at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1515)
08-17 13:12:46.503: E/Database(13328):  at library.DatabaseHandler.addUser(DatabaseHandler.java:69)
08-17 13:12:46.503: E/Database(13328):  at com.thryfting.www.RegisterActivity$register.doInBackground(RegisterActivity.java:135)
08-17 13:12:46.503: E/Database(13328):  at com.thryfting.www.RegisterActivity$register.doInBackground(RegisterActivity.java:1)
08-17 13:12:46.503: E/Database(13328):  at android.os.AsyncTask$2.call(AsyncTask.java:185)
08-17 13:12:46.503: E/Database(13328):  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
08-17 13:12:46.503: E/Database(13328):  at java.util.concurrent.FutureTask.run(FutureTask.java:138)
08-17 13:12:46.503: E/Database(13328):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
08-17 13:12:46.503: E/Database(13328):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
08-17 13:12:46.503: E/Database(13328):  at java.lang.Thread.run(Thread.java:1027)

Below is my database code:

package library;

import java.util.HashMap;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DatabaseHandler extends SQLiteOpenHelper {

    // All Static variables
    // Database Version
    private static final int DATABASE_VERSION = 1;

    // Database Name
    private static final String DATABASE_NAME = "thryfting_api";

    // Login table name
    private static final String TABLE_LOGIN = "login";

    // Login Table Columns names
    private static final String KEY_ID = "id";
    private static final String KEY_NAME = "name";
    private static final String KEY_EMAIL = "email";
    private static final String KEY_UID = "uid";
    private static final String KEY_CREATED_AT = "created_at";

    public DatabaseHandler(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    // Creating Tables
    @Override
    public void onCreate(SQLiteDatabase db) {
        String CREATE_LOGIN_TABLE = "CREATE TABLE " + TABLE_LOGIN + "("
                + KEY_ID + " INTEGER PRIMARY KEY,"
                + KEY_NAME + " TEXT,"
                + KEY_EMAIL + " TEXT UNIQUE,"
                + KEY_UID + " INTEGER,"
                + KEY_CREATED_AT + " TEXT" + ")";
        db.execSQL(CREATE_LOGIN_TABLE);
    }

    // Upgrading database
    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        // Drop older table if existed
        db.execSQL("DROP TABLE IF EXISTS " + TABLE_LOGIN);

        // Create tables again
        onCreate(db);
    }

    /**
     * Storing user details in database
     * */
    public void addUser(String name, String email, String uid, String created_at) {
        SQLiteDatabase db = this.getWritableDatabase();

        ContentValues values = new ContentValues();
        values.put(KEY_NAME, name); // Name
        values.put(KEY_EMAIL, email); // Email
        values.put(KEY_UID, uid); // Email
        values.put(KEY_CREATED_AT, created_at); // Created At

        // Inserting Row
        db.insert(TABLE_LOGIN, null, values);
        db.close(); // Closing database connection
    }

    /**
     * Getting user data from database
     * */
    public HashMap<String, String> getUserDetails(){
        HashMap<String,String> user = new HashMap<String,String>();
        String selectQuery = "SELECT  * FROM " + TABLE_LOGIN;

        SQLiteDatabase db = this.getReadableDatabase();
        Cursor cursor = db.rawQuery(selectQuery, null);
        // Move to first row
        cursor.moveToFirst();
        if(cursor.getCount() > 0){
            user.put("name", cursor.getString(1));
            user.put("email", cursor.getString(2));
            user.put("uid", cursor.getString(3));
            user.put("created_at", cursor.getString(4));
        }
        cursor.close();
        db.close();
        // return user
        return user;
    }

    /**
     * Getting user login status
     * return true if rows are there in table
     * */
    public int getRowCount() {
        String countQuery = "SELECT  * FROM " + TABLE_LOGIN;
        SQLiteDatabase db = this.getReadableDatabase();
        Cursor cursor = db.rawQuery(countQuery, null);
        int rowCount = cursor.getCount();
        db.close();
        cursor.close();

        // return row count
        return rowCount;
    }

    /**
     * Re crate database
     * Delete all tables and create them again
     * */
    public void resetTables(){
        SQLiteDatabase db = this.getWritableDatabase();
        // Delete All Rows
        db.delete(TABLE_LOGIN, null, null);
        db.close();
    }

}
  • 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-10T08:28:20+00:00Added an answer on June 10, 2026 at 8:28 am

    the error message

    table login has no column named uid

    indicates that your database is not in the state you expect it. You do create that table with a column named uid (KEY_UID) but you have most likely added that column after the database was already created on your device. Once it is created it will persist until you explicitly delete that file or uninstall your app. And onCreate will not be executed again until the database file is missing.

    What you need to do is to upgrade the database version each time you change the table definitions. That will trigger the onUpgrade code which will then recreate your table the way you defined it.

    Your fix is most likely just

    private static final int DATABASE_VERSION = 2;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I want to construct a data frame in an Rcpp function, but when I
I'm trying to create an if statement in PHP that prevents a single post
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

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.