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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:04:53+00:00 2026-06-12T20:04:53+00:00

I am working on an Application where i have to use multi threading. I

  • 0

I am working on an Application where i have to use multi threading. I have a single instance of SQLiteOpenHelper class throughout my application where i have methods to open and close database and some methods to insert and fetch data.

Now my problem is, I open database in First Thread and start transactions at the same time Second Thread also get the opened database object and start transactions.

The First thread complete its process and close the database on the other side my Second thread is working and the Second Thread gets that the database is closed.

Its some logical issue please someone help me to solve this problem how i can handle the closing the database in a proper way.

Thanks in advance

  • 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-12T20:04:54+00:00Added an answer on June 12, 2026 at 8:04 pm

    I have a single instance of SQLiteOpenHelper class throughout my application where i have methods to open and close database and some methods to insert and fetch data.

    You should only close the database when you are completely done with it, such as when the activity or service that created these threads is destroyed.

    It is also not out of the question for you to simply never close the database. If you implement a ContentProvider, you will never close your database. While this may cause warnings in LogCat about leaking open database handles, SQLite’s transactional nature means that failing to close a database should not cause any particular problems (e.g., failed to flush a buffer).

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

Sidebar

Related Questions

I am working on setting up a multi-tenant, seperate database application and have made
I have am working on a web application that makes use of helper classes.
I am working on a ASP.NET MVC 2.0 Multi-Presentation web application which would use
I have an EF 4.2 EDMX model which I use in a multi-tenant application.
I'm currently working on a Java application which should have the capability to use
I am working on WebSphere application server recently. And now i have to use
I'm working on a multi-tenant SharePoint provisioning application and plan to use Powershell for
I'm working on a multi-tenant ASP.NET MVC application. So far we have been using
I have a multi-threaded Python application that makes use of the built in logging
I am working on application for Ipad.in this application i have a UIButton on

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.