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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:18:55+00:00 2026-06-14T21:18:55+00:00

can anyone please help. I’ve seen many people with the same problem and looked

  • 0

can anyone please help. I’ve seen many people with the same problem and looked at all suggestions but still cannot get this to work. I have tried to unistall the application and install again, I have tried to change the version number and start again. I’ve debugged the code and it does go into the onCreate function, but when I go to make a select query it says the users table does not exist. Any help would greatly be appreciated. Thanks guys

DatabaseHandler Class

public class DatabaseHandler extends SQLiteOpenHelper 
{   
    // Variables
    protected static final int DATABASE_VERSION = 1;            
    protected static final String DATABASE_NAME = "MyUser.db";

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

    // Creating Tables 
    @Override
    public void onCreate(SQLiteDatabase db) 
    {           
        // Create the Users table
        // NOTE: I have the column variables saved above
        String CREATE_USERS_TABLE = "CREATE TABLE IF NOT EXISTS Users("
  + KEY_PRIMARY_ID + " " + INTEGER + " " + PRIMARY_KEY + " " + AUTO_INCREMENT + " " + NOT_NULL + "," + USERS_KEY_EMAIL + " " + NVARCHAR+"(1000)" + " " + UNIQUE + " " + NOT_NULL + "," + USERS_KEY_PIN + " " + NVARCHAR+"(10)" + " " + NOT_NULL + ")"; 
  db.execSQL(CREATE_USERS_TABLE);
    }

    // Upgrading database 
    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) 
    { 
      db.execSQL("DROP TABLE IF EXISTS Users"); 
        onCreate(db); 
    }

UserDataSource class

public class UserDataSource 
{
    private SQLiteDatabase db;  
    private DatabaseHandler dbHandler;

    public UserDataSource(Context context) 
    {
        dbHandler = new DatabaseHandler(context);
    }

    public void OpenWriteable() throws SQLException 
    {
        db = dbHandler.getWritableDatabase();
    }

    public void Close() 
    {
        dbHandler.close();
    }

    // Validate the user login with the username and password provided
    public void ValidateLogin(String username, String pin) throws CustomException
    {   
         Cursor cursor = db.rawQuery(   "select * from Users where " + DatabaseHandler.USERS_KEY_EMAIL + " = '" + username + "'" + " and " + DatabaseHandler.USERS_KEY_PIN + " = '" + pin + "'" , null);

         ........
    }

Then in the activity class, I’m calling

UserDataSource uds = new UserDataSource (this);
uds.OpenWriteable();
uds.ValidateLogin("name", "pin");

Any help would be great, thanks very much
Graham

The following is the attached log from the error report

11-23 17:47:46.414: I/SqliteDatabaseCpp(26717): sqlite returned: error code = 1, msg = no such table: Users, db=/data/data/prometric.myitemwriter/databases/MyUser.db
11-23 17:47:57.085: D/AndroidRuntime(26717): Shutting down VM
11-23 17:47:57.085: W/dalvikvm(26717): threadid=1: thread exiting with uncaught exception (group=0x40bec1f8)
11-23 17:47:57.171: D/dalvikvm(26717): GC_CONCURRENT freed 575K, 8% free 8649K/9351K, paused 2ms+6ms
11-23 17:47:57.179: E/AndroidRuntime(26717): FATAL EXCEPTION: main
11-23 17:47:57.179: E/AndroidRuntime(26717): java.lang.IllegalStateException: Could not execute method of the activity
11-23 17:47:57.179: E/AndroidRuntime(26717):    at android.view.View$1.onClick(View.java:3091)
11-23 17:47:57.179: E/AndroidRuntime(26717):    at android.view.View.performClick(View.java:3558)
11-23 17:47:57.179: E/AndroidRuntime(26717):    at android.view.View$PerformClick.run(View.java:14152)
11-23 17:47:57.179: E/AndroidRuntime(26717):    at android.os.Handler.handleCallback(Handler.java:605)
11-23 17:47:57.179: E/AndroidRuntime(26717):    at android.os.Handler.dispatchMessage(Handler.java:92)
11-23 17:47:57.179: E/AndroidRuntime(26717):    at android.os.Looper.loop(Looper.java:137)
11-23 17:47:57.179: E/AndroidRuntime(26717):    at android.app.ActivityThread.main(ActivityThread.java:4514)
11-23 17:47:57.179: E/AndroidRuntime(26717):    at java.lang.reflect.Method.invokeNative(Native Method)
11-23 17:47:57.179: E/AndroidRuntime(26717):    at java.lang.reflect.Method.invoke(Method.java:511)
11-23 17:47:57.179: E/AndroidRuntime(26717):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
11-23 17:47:57.179: E/AndroidRuntime(26717):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
11-23 17:47:57.179: E/AndroidRuntime(26717):    at dalvik.system.NativeStart.main(Native Method)
11-23 17:47:57.179: E/AndroidRuntime(26717): Caused by: java.lang.reflect.InvocationTargetException
11-23 17:47:57.179: E/AndroidRuntime(26717):    at java.lang.reflect.Method.invokeNative(Native Method)
11-23 17:47:57.179: E/AndroidRuntime(26717):    at java.lang.reflect.Method.invoke(Method.java:511)
11-23 17:47:57.179: E/AndroidRuntime(26717):    at android.view.View$1.onClick(View.java:3086)
11-23 17:47:57.179: E/AndroidRuntime(26717):    ... 11 more
11-23 17:47:57.179: E/AndroidRuntime(26717): Caused by: android.database.sqlite.SQLiteException: no such table: Users: , while compiling: select * from Users where email = '' and pin = ''
11-23 17:47:57.179: E/AndroidRuntime(26717):    at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
11-23 17:47:57.179: E/AndroidRuntime(26717):    at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:68)
11-23 17:47:57.179: E/AndroidRuntime(26717):    at android.database.sqlite.SQLiteProgram.compileSql(SQLiteProgram.java:143)
11-23 17:47:57.179: E/AndroidRuntime(26717):    at android.database.sqlite.SQLiteProgram.compileAndbindAllArgs(SQLiteProgram.java:361)
11-23 17:47:57.179: E/AndroidRuntime(26717):    at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:127)
11-23 17:47:57.179: E/AndroidRuntime(26717):    at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:94)
11-23 17:47:57.179: E/AndroidRuntime(26717):    at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:53)
11-23 17:47:57.179: E/AndroidRuntime(26717):    at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:47)
11-23 17:47:57.179: E/AndroidRuntime(26717):    at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1685)
11-23 17:47:57.179: E/AndroidRuntime(26717):    at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1659)
11-23 17:47:57.179: E/AndroidRuntime(26717):    at projectname.database.UserDataSource.ValidateLogin(UserDataSource.java:73)
11-23 17:47:57.179: E/AndroidRuntime(26717):    at projectname.LoginActivity.btn_login_Click(LoginActivity.java:47)
11-23 17:47:57.179: E/AndroidRuntime(26717):    ... 14 more
  • 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-14T21:18:56+00:00Added an answer on June 14, 2026 at 9:18 pm

    thanks for the help. The reason why this was not working was because the database inserts were not being committed. The following is how I got around the issue if anyone is interested.

    // Create the Users table
    db.beginTransaction();
    try {
        Log.d(DatabaseHandler.class.getName(), "Creating table " + TABLE_USERS);
        String CREATE_USERS_TABLE = "CREATE TABLE IF NOT EXISTS " + TABLE_USERS + "("
                + KEY_PRIMARY_ID + " " + INTEGER + " " + PRIMARY_KEY + ","
                + USERS_KEY_EMAIL + " " + NVARCHAR+"(1000)" + " " + UNIQUE + " " + NOT_NULL + ","
                + USERS_KEY_PIN + " " + NVARCHAR+"(10)" + " " + NOT_NULL + ");"; 
        db.execSQL(CREATE_USERS_TABLE);
        db.setTransactionSuccessful();
    }
    catch (SQLException e) {
        Log.e(DatabaseHandler.class.getName(), "Error Creating table " + TABLE_USERS + " ... " + e.getMessage());
        // Do whatever you want here
    }
    finally {
        db.endTransaction();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone please help me by solving problem in my application.I have three input
Can anyone please help me to identify the exact are of problem. Is it
Can anyone please help. I have a problem where I need to loop through
Can anyone please help in implementing the same functionality of optgroup using struts.
Can anyone please help me with the Algorithm for this problem (its an Interview
Can anyone please help me to know how to open an excel sheet in
Can anyone please help me to work out how to achieve the following? I
Can anyone please help me to add video controls (play, pause, forward, seekbar) to
Can anyone please help me with this...I'm not very good with regular expressions and
Can anyone please help me to understand how should i access json data in

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.