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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:17:41+00:00 2026-05-30T19:17:41+00:00

I have been having issues getting my SQLite Databases to work and I think

  • 0

I have been having issues getting my SQLite Databases to work and I think it might be something other than my code. I downloaded a sample SQLite app from here and it doesn’t work on my emulator or my phone. Here are the LogCat errors for you to look at.

If you have any ideas on what might be going on please let me know.

03-04 00:48:26.472: E/Database(6653): Error inserting DeptID=3 DeptName=HR
03-04 00:48:26.472: E/Database(6653): android.database.sqlite.SQLiteConstraintException: error code 19: constraint failed
03-04 00:48:26.472: E/Database(6653):   at android.database.sqlite.SQLiteStatement.native_execute(Native Method)
03-04 00:48:26.472: E/Database(6653):   at android.database.sqlite.SQLiteStatement.execute(SQLiteStatement.java:61)
03-04 00:48:26.472: E/Database(6653):   at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1582)
03-04 00:48:26.472: E/Database(6653):   at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1426)
03-04 00:48:26.472: E/Database(6653):   at mina.android.DatabaseDemo.DatabaseHelper.InsertDepts(DatabaseHelper.java:144)
03-04 00:48:26.472: E/Database(6653):   at mina.android.DatabaseDemo.DatabaseHelper.onCreate(DatabaseHelper.java:65)
03-04 00:48:26.472: E/Database(6653):   at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:126)
03-04 00:48:26.472: E/Database(6653):   at mina.android.DatabaseDemo.DatabaseHelper.getEmployeeCount(DatabaseHelper.java:105)
03-04 00:48:26.472: E/Database(6653):   at mina.android.DatabaseDemo.AddEmployee.onStart(AddEmployee.java:40)
03-04 00:48:26.472: E/Database(6653):   at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1129)
03-04 00:48:26.472: E/Database(6653):   at android.app.Activity.performStart(Activity.java:3791)
03-04 00:48:26.472: E/Database(6653):   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1624)
03-04 00:48:26.472: E/Database(6653):   at android.app.ActivityThread.startActivityNow(ActivityThread.java:1491)
03-04 00:48:26.472: E/Database(6653):   at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:127)
03-04 00:48:26.472: E/Database(6653):   at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:339)
03-04 00:48:26.472: E/Database(6653):   at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:657)
03-04 00:48:26.472: E/Database(6653):   at android.widget.TabHost.setCurrentTab(TabHost.java:329)
03-04 00:48:26.472: E/Database(6653):   at android.widget.TabHost.addTab(TabHost.java:219)
03-04 00:48:26.472: E/Database(6653):   at mina.android.DatabaseDemo.DatabaseDemo.SetupTabs(DatabaseDemo.java:85)
03-04 00:48:26.472: E/Database(6653):   at mina.android.DatabaseDemo.DatabaseDemo.onCreate(DatabaseDemo.java:32)
03-04 00:48:26.472: E/Database(6653):   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-04 00:48:26.472: E/Database(6653):   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
03-04 00:48:26.472: E/Database(6653):   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
03-04 00:48:26.472: E/Database(6653):   at android.app.ActivityThread.access$1500(ActivityThread.java:117)
03-04 00:48:26.472: E/Database(6653):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
03-04 00:48:26.472: E/Database(6653):   at android.os.Handler.dispatchMessage(Handler.java:99)
03-04 00:48:26.472: E/Database(6653):   at android.os.Looper.loop(Looper.java:130)
03-04 00:48:26.472: E/Database(6653):   at android.app.ActivityThread.main(ActivityThread.java:3688)
03-04 00:48:26.472: E/Database(6653):   at java.lang.reflect.Method.invokeNative(Native Method)
03-04 00:48:26.472: E/Database(6653):   at java.lang.reflect.Method.invoke(Method.java:507)
03-04 00:48:26.472: E/Database(6653):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
03-04 00:48:26.472: E/Database(6653):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
03-04 00:48:26.472: E/Database(6653):   at dalvik.system.NativeStart.main(Native Method)
03-04 00:48:26.925: W/PhoneWindow(6653): Previously focused view reported id 2131034112 during save, but can't be found during restore.
  • 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-30T19:17:42+00:00Added an answer on May 30, 2026 at 7:17 pm

    There’s an error in this example. Look at DatabaseHelper:144. You’ll find this line of code twice:

    db.insert(deptTable, colDeptID, cv);
    

    The first call succeeds, the second is trying to insert a row with the same ID, so it violates the primary key constraint. Delete it.

    I don’t understand why someone is publishing untested code examples…

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

Sidebar

Related Questions

I've been having issues getting a service to start. I have 2 other services
I'm having some issues with getting my mouse events to work. I have a
As many of you may already know I have been having issues with another
I have been having some issues with LINQ-To-SQL around memory usage. I'm using it
I have been having the following problem, i think it's probably due to the
Originally, I was having some issues getting this code to function, but after a
Ok, I have been searching thick and thin, and I am having some issues
I have been having this issue in iterating through an array of keys and
I have been having some problems trying to get my PHP running. When I
I have been having a lot of trouble figuring out how I can access

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.