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

The Archive Base Latest Questions

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

I’m getting the following exception when attempting to query the sqlite database table for

  • 0

I’m getting the following exception when attempting to query the sqlite database table for all rows:

08-24 20:36:48.134: E/AndroidRuntime(351): java.lang.RuntimeException: 
Unable to start activity ComponentInfo{se.p950tes.workouttracker/se.p950tes.workouttracker.SavedActivity}:
android.database.sqlite.SQLiteException: no such column: col_distance: , 
while compiling: SELECT _id, col_date, col_time, col_distance, col_route FROM workout

I haven’t ever updated the database, this is the first time I’ve installed the app on this device, and it’s also tested on the emulator with the same result. Even so I’ve tried to up the version number a few times, with no change.

Here’s my code. The exception is thrown in the getAll method.

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

public class DatabaseHandler
{
    public static final String DATABASE_NAME = "workout_tracker";

    private static final String KEY_ID       = "_id";
    private static final String KEY_DATE     = "col_date";
    private static final String KEY_TIME     = "col_time";
    private static final String KEY_DISTANCE = "col_distance";
    private static final String KEY_ROUTE    = "col_route";

    private static final String TABLE = "workout";
    private static final String[] ALL_FIELDS = {KEY_ID, KEY_DATE, KEY_TIME, KEY_DISTANCE, KEY_ROUTE};

    private static final int DATABASE_VERSION = 3;

    private final Context context;
    private DatabaseHelper helper;
    private SQLiteDatabase db;

    public DatabaseHandler(Context context)
    {
        this.context = context;
        this.helper = new DatabaseHelper(context);
    }

    public void connect()
    {
        db = helper.getWritableDatabase();
    }
    public void disconnect()
    {
        db.close();
    }

    public Cursor getAll()
    {
        return db.query(TABLE, ALL_FIELDS, null, null, null, null, null);
    }

    private static class DatabaseHelper extends SQLiteOpenHelper
    {
        private static final String CREATE = "CREATE TABLE " + TABLE + "("
                                                + KEY_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
                                                + KEY_DATE + " INTEGER NOT NULL, "
                                                + KEY_TIME + " INTEGER NOT NULL, "
                                                + KEY_DISTANCE + "INTEGER NOT NULL, "
                                                + KEY_ROUTE + " BLOB NOT NULL"
                                                + ");";
        DatabaseHelper(Context context)
        {
            super(context, DATABASE_NAME, null, DATABASE_VERSION);
        }
        @Override
        public void onCreate(SQLiteDatabase db)
        {
            try
            {
                db.execSQL(CREATE);
            }
            catch(SQLException e)
            {
                e.printStackTrace();
            }
        }
        @Override
        public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
        {
            Log.w("DBHandler", "Upgrading database from version "+oldVersion+" to "+newVersion+", which will destroy all old data");
            db.execSQL("DROP TABLE IF EXISTS "+TABLE);
            onCreate(db);
        }
    }
}

I realise this “Why do I get this SQLiteException” question is asked a lot, but so far most issues I’ve seen people have have been not enclosing strings in quotation marks and whatnot. I apologise in advance if it turns out to be a duplicate.

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

    You are missing a leading space in "INTEGER NOT NULL, ".

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I have thousands of HTML files to process using Groovy/Java and I need to
I have a view passing on information from a database: def serve_article(request, id): served_article
I have a reasonable size flat file database of text documents mostly saved in
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example

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.