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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:26:52+00:00 2026-05-27T22:26:52+00:00

Iam working on a contact list application i need to do 2 table because

  • 0

Iam working on a contact list application i need to do 2 table because i want to make a join .I am trying to make 2 tables in my database but i get some error when creating contact test1 table.This is the error i get:

                 01-04 18:47:40.152: I/Database(8360): sqlite returned: error code = 1, msg = unknown column "idgrup" in foreign key definition
                  01-04 18:47:40.152: E/Database(8360): Failure 1 (unknown column "idgrup" in foreign key definition) on 0x123c38 when preparing 'CREATE TABLE contactTest1 (_id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL,phone TEXT NOT NULL,email TEXT NOT NULL,url TEXT NOT NULL,adresa TEXT NOT NULL,idgrupINTEGER NOT NULL ,FOREIGN KEY (idgrup) REFERENCES contactTest2 (_id));'.
                  01-04 18:47:40.230: E/SQLiteOpenHelper(8360): Couldn't open contactsdataase.db for writing (will try read-only):
                  01-04 18:47:40.230: E/SQLiteOpenHelper(8360): android.database.sqlite.SQLiteException: unknown column "idgrup" in foreign key definition: CREATE TABLE contactTest1 (_id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL,phone TEXT NOT NULL,email TEXT NOT NULL,url TEXT NOT NULL,adresa TEXT NOT NULL,idgrupINTEGER NOT NULL ,FOREIGN KEY (idgrup) REFERENCES contactTest2 (_id));
                 01-04 18:47:40.230: E/SQLiteOpenHelper(8360):  at android.database.sqlite.SQLiteDatabase.native_execSQL(Native Method)
                01-04 18:47:40.230: E/SQLiteOpenHelper(8360):   at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1727)
                01-04 18:47:40.230: E/SQLiteOpenHelper(8360):   at org.example.dbcontactconsole.DbCreate.onCreate(DbCreate.java:24)
                01-04 18:47:40.230: E/SQLiteOpenHelper(8360):   at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:106)
                01-04 18:47:40.230: E/SQLiteOpenHelper(8360):   at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:158)
                01-04 18:47:40.230: E/SQLiteOpenHelper(8360):   at org.example.dbcontactconsole.DbContactConsole.getContacts(DbContactConsole.java:203)
                01-04 18:47:40.230: E/SQLiteOpenHelper(8360):   at org.example.dbcontactconsole.DbContactConsole.showDatabaseContent(DbContactConsole.java:214)
                01-04 18:47:40.230: E/SQLiteOpenHelper(8360):   at org.example.dbcontactconsole.DbContactConsole.onCreate(DbContactConsole.java:44)
                 01-04 18:47:40.230: E/SQLiteOpenHelper(8360):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
                01-04 18:47:40.230: E/SQLiteOpenHelper(8360):   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
                01-04 18:47:40.230: E/SQLiteOpenHelper(8360):   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
                  01-04 18:47:40.230: E/SQLiteOpenHelper(8360):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
                01-04 18:47:40.230: E/SQLiteOpenHelper(8360):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
                01-04 18:47:40.230: E/SQLiteOpenHelper(8360):   at android.os.Handler.dispatchMessage(Handler.java:99)
                 01-04 18:47:40.230: E/SQLiteOpenHelper(8360):  at android.os.Looper.loop(Looper.java:123)
                01-04 18:47:40.230: E/SQLiteOpenHelper(8360):   at android.app.ActivityThread.main(ActivityThread.java:4627)
                01-04 18:47:40.230: E/SQLiteOpenHelper(8360):   at java.lang.reflect.Method.invokeNative(Native Method)
                01-04 18:47:40.230: E/SQLiteOpenHelper(8360):   at java.lang.reflect.Method.invoke(Method.java:521)
                01-04 18:47:40.230: E/SQLiteOpenHelper(8360):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
                01-04 18:47:40.230: E/SQLiteOpenHelper(8360):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
               01-04 18:47:40.230: E/SQLiteOpenHelper(8360):    at dalvik.system.NativeStart.main(Native Method)

here i create the database:

  public class DbCreate extends SQLiteOpenHelper{
private static final String DB_NAME = "contactsdataase.db";
private static final int DB_VERSION = 2;

/** Create a helper object for the Events database */
   public DbCreate(Context context) { 
      super(context, DB_NAME, null,DB_VERSION); 
   }

   @Override
   public void onCreate(SQLiteDatabase db) { 
       db.execSQL("CREATE TABLE " + DbConstants.TABLE_NUME + " " +
                "(" + DbConstants.Group_ID + " INTEGER PRIMARY KEY , " + 
                      DbConstants.GROUP_NAME+");");
       db.execSQL("CREATE TABLE " + DbConstants.TABLE_NAME + " " +
                "(" + _ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + 
                      DbConstants.NAME + " TEXT NOT NULL," + 
                      DbConstants.PHONE + " TEXT NOT NULL," +
                      DbConstants.EMAIL + " TEXT NOT NULL," +
                      DbConstants.URL_STRING+ " TEXT NOT NULL,"+
                      DbConstants.ADRESS+ " TEXT NOT NULL,"+
                      DbConstants.Grupid+ "INTEGER NOT NULL ,FOREIGN KEY ("+DbConstants.Grupid+") REFERENCES "+DbConstants.TABLE_NUME+" ("+DbConstants.Group_ID+"));");

   }

   @Override
   public void onUpgrade(SQLiteDatabase db, int oldVersion, 
         int newVersion) {
      db.execSQL("DROP TABLE IF EXISTS " + DbConstants.TABLE_NUME);
      db.execSQL("DROP TABLE IF EXISTS " + DbConstants.TABLE_NAME);
      onCreate(db);
   }
  • 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-27T22:26:53+00:00Added an answer on May 27, 2026 at 10:26 pm

    idgrupINTEGER in your SQL script is messing up the definition of that column. You should have a space in between.

    Code:

    DbConstants.Grupid+ " INTEGER NOT NULL ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a contact list application I need to create 2 tables
I am working on a contact list project and the last thing i need
I am working at a contacl list database application and when i click on
I am working on a contact list application and i am getting an error
I am working on a contact list project in android and i want to
Iam working on Ubuntu.(Linux) I want to redirect from the page one.php to two.php,
I am working on an application in which i need to fetch all the
I am trying to create a basic navigation bar using an unordered list, but
Here is my problem: I am creating a WP7 application and need to list
I am working on a contact list project and so far i can add,modify

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.