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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:20:50+00:00 2026-05-27T03:20:50+00:00

Im getting an error I cannot figure out. Hope you can help! I’m making

  • 0

Im getting an error I cannot figure out. Hope you can help!

I’m making a table of groups names with a unique id which is the primary key.

public class GroupDatabaseAdapter {

public static final String KEY_ID = "id";
public static final String KEY_NAME = "name";
private static final String DATABASE_TABLE = "groep";
private Context context;
private SQLiteDatabase database;
private GroupDatabaseHandler dbHandler;

public GroupDatabaseAdapter(Context context) {
    this.context = context;
}

public GroupDatabaseAdapter open() throws SQLException {
    dbHandler = new GroupDatabaseHandler(context);
    database = dbHandler.getWritableDatabase();
    return this;
}

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

/**
 * Create a new group If the group is successfully created return the new
 * rowId for that note, otherwise return a -1 to indicate failure.
 */
public long createGroup(long id, String name) 
{
    ContentValues values = createContentValues(id, name);

    return database.insert(DATABASE_TABLE, null, values);
}
/**
 * Return a Cursor over the list of all groups in the database
 * 
 * @return Cursor over all groups
 */
public Cursor fetchAllGroups() {
    return database.query(DATABASE_TABLE, new String[] { KEY_ID,
            KEY_NAME }, null, null, null,
            null, null);
}

private ContentValues createContentValues(Long id, String name) {
    ContentValues values = new ContentValues();
    values.put(KEY_ID, id);
    values.put(KEY_NAME, name);
    return values;
}
}



public class GroupDatabaseHandler extends SQLiteOpenHelper {

private static final String DATABASE_NAME = "groups.db";

private static final int DATABASE_VERSION = 1;

// Database creation sql statement
private static final String DATABASE_CREATE = "CREATE TABLE lesson (id INTEGER PRIMARY KEY NOT NULL , name TEXT NOT NULL);";

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

@Override
public void onCreate(SQLiteDatabase database) 
{
    database.execSQL(DATABASE_CREATE);
}

}

I call these classes from another class with following code:

GroupDatabaseAdapter groupDb = new GroupDatabaseAdapter(this).open();
long id = groupDb.createGroup(641, "3 bac group 2");
System.out.println(id);
id = groupDb.createGroup(642, "3 bac group 3");
System.out.println(id);

The error I get is

11-24 23:08:07.036: I/Database(11436): sqlite returned: error code = 1, msg = near "group": syntax error
11-24 23:08:07.075: E/Database(11436): Error inserting id=1 name=3 bac group 2
11-24 23:08:07.075: E/Database(11436): android.database.sqlite.SQLiteException: near "group": syntax error: , while compiling: INSERT INTO group(id, name) VALUES(?, ?);

In the same program I made another table which does work. The only difference between that table and this one is at the primary key. In the other table it is auto incremented, here I want the rowid to be the id of the group.
Hope someone sees my mistake.

Ok I changed group into groep (dutch for group) and now I get these errors:

11-25 00:09:10.812: I/Database(457): sqlite returned: error code = 1, msg = no such table: groep
11-25 00:09:11.082: E/Database(457): Error inserting _id=1 name=3 bac group 2
11-25 00:09:11.082: E/Database(457): android.database.sqlite.SQLiteException: no such table: groep: , while compiling: INSERT INTO groep(_id, name) VALUES(?, ?);

Cheers!
Kat

  • 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-05-27T03:20:51+00:00Added an answer on May 27, 2026 at 3:20 am

    You created a table called lesson and insert into a table called groep.

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

Sidebar

Related Questions

I cannot seem to figure out I am getting the following error in IE
I am getting an error that I cannot figure out: ActionView::MissingTemplate (Missing template cluster/delete_stuff.erb
So I am getting this cross thread error and I cannot figure it out.
I am getting error c2440 in my compiler but I cannot figure out what
I'm getting a strange error, and I cannot figure out the problem. I'm sending
Hey everyone, I am getting a heap corruption error I cannot figure out. char
I cannot figure out why I keep getting a null ref on filename when
I am getting a segmentation fault on my getaddrinfo call and cannot figure out
I can't seem to figure out why I am getting an InvalidCastException running the
I'm probably making a newbie mistake here, but I can't figure out how to

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.