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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:21:55+00:00 2026-05-29T08:21:55+00:00

I am wonder about how to update the table. I have use below two

  • 0

I am wonder about how to update the table.

I have use below two method to update the Table.

Which one is right one and Whats wrong in it ?
As i got the Exception while use both.

Code:

//First One For Update
public boolean setFavouriteBook(String id){
    String query = "update Articles set type = 0 Where address = '"+id+"'";
    myDataBase.rawQuery(query, null);
    return true;
}

// Second One for Update
//---updates a title---
public boolean setFavourite(String address) 
{
    ContentValues args = new ContentValues();
    args.put("type", 0);

    return myDataBase.update("Articles", args, "address = '"+address+"'", null) > 0;
}

And the Log is:

    02-08 10:29:56.010: INFO/Database(10350): sqlite returned: error code = 8, msg = prepared statement aborts at 28: [UPDATE Articles SET type=? WHERE address = '3']
02-08 10:29:56.010: ERROR/Database(10350): Error updating type=0 using UPDATE Articles SET type=? WHERE address = '3'
02-08 10:29:56.021: DEBUG/AndroidRuntime(10350): Shutting down VM
02-08 10:29:56.021: WARN/dalvikvm(10350): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
02-08 10:29:56.041: ERROR/AndroidRuntime(10350): FATAL EXCEPTION: main
02-08 10:29:56.041: ERROR/AndroidRuntime(10350): android.database.sqlite.SQLiteException: error code 8: attempt to write a readonly database
02-08 10:29:56.041: ERROR/AndroidRuntime(10350):     at android.database.sqlite.SQLiteStatement.native_execute(Native Method)
02-08 10:29:56.041: ERROR/AndroidRuntime(10350):     at android.database.sqlite.SQLiteStatement.execute(SQLiteStatement.java:55)
02-08 10:29:56.041: ERROR/AndroidRuntime(10350):     at android.database.sqlite.SQLiteDatabase.updateWithOnConflict(SQLiteDatabase.java:1692)
02-08 10:29:56.041: ERROR/AndroidRuntime(10350):     at android.database.sqlite.SQLiteDatabase.update(SQLiteDatabase.java:1622)
02-08 10:29:56.041: ERROR/AndroidRuntime(10350):     at com.project.SkadebogenApp.DataBaseHelper.setFavourite(DataBaseHelper.java:417)
02-08 10:29:56.041: ERROR/AndroidRuntime(10350):     at com.project.SkadebogenApp.CommonWebViewActivity.onClick(CommonWebViewActivity.java:204)
02-08 10:29:56.041: ERROR/AndroidRuntime(10350):     at android.view.View.performClick(View.java:2408)
02-08 10:29:56.041: ERROR/AndroidRuntime(10350):     at android.view.View$PerformClick.run(View.java:8816)
02-08 10:29:56.041: ERROR/AndroidRuntime(10350):     at android.os.Handler.handleCallback(Handler.java:587)
02-08 10:29:56.041: ERROR/AndroidRuntime(10350):     at android.os.Handler.dispatchMessage(Handler.java:92)
02-08 10:29:56.041: ERROR/AndroidRuntime(10350):     at android.os.Looper.loop(Looper.java:123)
02-08 10:29:56.041: ERROR/AndroidRuntime(10350):     at android.app.ActivityThread.main(ActivityThread.java:4627)
02-08 10:29:56.041: ERROR/AndroidRuntime(10350):     at java.lang.reflect.Method.invokeNative(Native Method)
02-08 10:29:56.041: ERROR/AndroidRuntime(10350):     at java.lang.reflect.Method.invoke(Method.java:521)
02-08 10:29:56.041: ERROR/AndroidRuntime(10350):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
02-08 10:29:56.041: ERROR/AndroidRuntime(10350):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
02-08 10:29:56.041: ERROR/AndroidRuntime(10350):     at dalvik.system.NativeStart.main(Native Method)
02-08 10:29:56.071: WARN/ActivityManager(59):   Force finishing activity com.project.SkadebogenApp/.CommonWebViewActivity
02-08 10:29:56.600: WARN/ActivityManager(59): Activity pause timeout for HistoryRecord{450b78f8 com.project.SkadebogenApp/.CommonWebViewActivity}
  • 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-29T08:21:56+00:00Added an answer on May 29, 2026 at 8:21 am

    If your database is in SDCard.

    If you have your database in SDCard, so you have to give WRITE_EXTERNAL_STORAGE permission in your Manifest file. You can check this answer for the same problem.

    Else you can use

    SQLiteDatabase.OPEN_READWRITE instead of SQLiteDatabase.OPEN_READONLY while you are opening your database.

     checkDB = SQLiteDatabase.openDatabase(myPath, null,
                                                    SQLiteDatabase.OPEN_READWRITE);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm learning about table design in SQL and I'm wonder how to create a
This behavior is making me wonder about my sanity.. I have a form that
After reading about Mapper XMLs I can't help to wonder how one might go
I have a website in which every page is served via HTTPS. On one
Assume I have a table named bookLibrary in which the unique id of a
I just wonder about an easy way to make i18n inside Smarty templates. Something
I was wonder about the proper usage of ManualWorkflowSchedulerService.RunWorkflow(). Do I need to synchronize
When I make a query, I often wonder about this: Is it better to
I'm working on a browser-game and I can't help but wonder about what's the
I'm doing Cay Horstmann's combinator parser exercises, I wonder about the best way 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.