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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:14:41+00:00 2026-06-12T06:14:41+00:00

I read all other SQLiteException no such table messages but didn’t find an answer

  • 0

I read all other “SQLiteException no such table” messages but didn’t find an answer to my point.

I’m creating an android application with multiple tables in database. I build it step by step.
I created first table A, and a form to add/edit data. I inspired myself with LoaderThrottle android sample. It was working perfectly.
After this, I created table B, exactly like table A, and a form to add data.

I then saw I forgot a field in table B. I tried to add this field and switched table B to version 2. But I had a lot of problem. “downgrade” and “upgrade” errors…
So I erased application data and un-installed the application from device, so database is deleted and recreated on first launch.

But now, when I launch the application, I have the exception << android.database.sqlite.SQLiteException: no such table: A: , while compiling: SELECT name, _id FROM A WHERE ((active = 1 ))>> ?!?

Why is dbHelper not creating the database? Do I have to explicitly call its onCreate method?
Do I need unique dbHelper for all tables of database or one dbHelper for each table (what I have now)?

Further information :
– In manifest, I have two providers, linked to content provider of each table.

Edit : Here is creation code for each table.

Table A (for which I have the exception) :

       public void onCreate(SQLiteDatabase db) {
       db.execSQL("CREATE TABLE " + ActivityTable.TABLE_NAME + " ("
               + ActivityTable._ID                + " INTEGER PRIMARY KEY, "
               + ActivityTable.COLUMN_NAME_TITLE  + " TEXT NOT NULL, "
               + ActivityTable.COLUMN_NAME_CODE   + " TEXT, "
               + ActivityTable.COLUMN_NAME_ACTIVE + " smallint NOT NULL  DEFAULT 1, "
               + ActivityTable.COLUMN_NAME_CPTI   + " smallint NOT NULL  DEFAULT 1 "
               + ");");
   }

Table B :

       public void onCreate(SQLiteDatabase db) {
       db.execSQL("CREATE TABLE " + TrackTable.TABLE_NAME + " ("
               + TrackTable._ID                     + " INTEGER PRIMARY KEY, "
               + TrackTable.COLUMN_NAME_DATE        + " long NOT NULL, "
               + TrackTable.COLUMN_NAME_ACTIVITY_ID + " int NOT NULL DEFAULT 0, " 
               + TrackTable.COLUMN_NAME_DAYPART     + " smallint NOT NULL  DEFAULT 0, "
               + TrackTable.COLUMN_NAME_NPQ         + " smallint NOT NULL  DEFAULT 0, " 
               + TrackTable.COLUMN_NAME_NBPID       + " long NOT NULL  DEFAULT 0 " 
               + ");");
   }

Thanks in advance for any clue.
Florent

  • 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-12T06:14:42+00:00Added an answer on June 12, 2026 at 6:14 am

    After multiple tries, I finally got myself unstuck.

    I give you my solution, even if I don’t really understand why I have to do so.
    Since my question had no answer, it could help someone someday.

    As a reminder, I started from LoaderThrottle android sample. Please refer to this file.

    In method onCreate of my child class derived from SQLiteOpenHelper, I change :

    db.execSQL("CREATE TABLE " + ...
    

    by :

    db.execSQL("CREATE TABLE IF NOT EXISTS " + ...
    

    Then, in onCreate method of child class derived from ContentProvider, I directly call DbHelper onCreate method :

         /**
         * Perform provider creation.
         */
        @Override
        public boolean onCreate() {
            mOpenHelper = new ActivityDbHelper(getContext());
            // Assumes that any failures will be reported by a thrown exception.
    
            SQLiteDatabase db = mOpenHelper.getWritableDatabase();
            mOpenHelper.onCreate(db);
    
            return true;
        }
    

    Enjoy,
    Florent

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

Sidebar

Related Questions

I've read all the other q's here regarding the topic but couldn't solve my
I have read all the other user's accounts of problems, but they don't seem
I've read all the other threads but I still don't get why my apps
I read all the other questions about this, but i can't understand why there
I have searched all other the web and read many instructions but it just
I've read almost all the other questions about the topic, but my code still
I've read all the posts I could find about this issue, but, to date,
Okay guys, I have read through all the other posts and question on jQuery
I know this seems like a repeat question, but i've read all the others
I read all of Microsoft's documentation but their claim is that it should work

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.