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

  • Home
  • SEARCH
  • 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 8762075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:26:19+00:00 2026-06-13T15:26:19+00:00

I use sqlite transaction in Android: SQLiteDatabase database = sqlite_helper.getWritableDatabase(); database.beginTransaction(); … database.setTransactionSuccessful(); database.endTransaction();

  • 0

I use sqlite transaction in Android:

SQLiteDatabase database = sqlite_helper.getWritableDatabase();

database.beginTransaction();
...
database.setTransactionSuccessful();
database.endTransaction();

My questions are :
1. Should I place endTransaction() in finally code block like this:

try {
    database.beginTransaction();
    ...
    database.setTransactionSuccessful();
}
finally {
    database.endTransaction();
}

If there are exepctions during database operations, will the database be rolled back automatically without using “finally”?

  1. When the transaction is not ended, can other threads read or write the same database? I hear sqlite in Android is threading safe, but I are not sure with it. I guess there will be some problems during transaction. Is there an error raised if another thread writes the same database with the same connection?
    I ever found this error in my app, but I don’t know whether it’s related to the threading safe problem:

android.database.sqlite.SQLiteMisuseException: library routine called out of sequence:

, while compiling

Does anyone help me to answer these questions? Thanks a lot!

  • 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-13T15:26:21+00:00Added an answer on June 13, 2026 at 3:26 pm

    1.you should always place endTransaction in finally block

    2.transaction in SQLite is thread safe,see the doc http://www.sqlite.org/atomiccommit.html

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

Sidebar

Related Questions

I am attempting to use a SQLite database to store emails locally in android.
What components can I use to use SQlite database with Delphi 6?
Please any on tell me can i use Sqlite database in my Windows Phone
I'm trying to store dollar amounts in the sqlite database provided by android but
I was trying to use SQLite database using ADO.NET Entity Framework 5 and I
I would like to use SQLite for some database functionality with a Java program
I am intending to use SQLite 3 with PHP 5. I found this: http://packages.debian.org/etch/web/php5-sqlite3
is it possible to use SQLite for a j2me application ? has anyone ever
Can I use Sqlite with IOS using phonegap (with no limitations) ? If you
Would be great to get some direction re trying to use sqlite for my

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.