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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T20:30:46+00:00 2026-06-08T20:30:46+00:00

I have an application that uses SQLite(version 3.7.2) to store data. I have a

  • 0

I have an application that uses SQLite(version 3.7.2) to store data. I have a SQLite connection shared between multiple threads that writes and reads from the same SQLite db. SQLite is compiled with DSQLITE_THREADSAFE=1 which means SQLite is in Serialized mode.

Quoting from SQLite docs

Serialized: In serialized mode, SQLite can be safely used by multiple
threads with no restriction.

On the contrary the SQLite Wiki entry says

Do not use the same database connection at the same time in more than
one thread

I tried with a sample application that spawns hundreds of threads and shares an SQLite handle to read & write which is working fine.

So is the SQLite wiki entry outdated or SQLite might not be able to handle read and write happening from different threads at the same time using the same connection?

  • 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-08T20:30:48+00:00Added an answer on June 8, 2026 at 8:30 pm

    EDIT

    DSQLITE_THREADSAFE=2: multi-thread mode
    The term "multi-thread" is a bit confusing in SQLite. Seems like in Multi-thread mode you cannot share a connection with other threads because the connection itself will not use mutexes to prevent one thread from modifying the connection while another thread is using it.

    DSQLITE_THREADSAFE=1: serialized mode
    However, in serialized mode, it will lock the data file and will use mutexes to control the access for the shared connection.

    From docs:
    … when SQLite is compiled with SQLITE_THREADSAFE=1, the SQLite library will itself serialize access to database connections and prepared statements so that the application is free to use the same database connection or the same prepared statement in different threads at the same time.

    So, when dealing with connections, serialized mode is thread-safe but multi-thread mode is not, although you still can have multiple connections to the same database.

    Source: http://www.sqlite.org/c3ref/c_config_getmalloc.html#sqliteconfigmultithread

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

Sidebar

Related Questions

I have a single-threaded application that uses 3 SQLite databases in 3 different files
I have an application that uses multiple WebViews. Nowhere do I set the priority
I have written an Android application that uses SQLite database which is saved in
I'm developing an application that uses SQLite as the primary data storage method. I
I have written a simple Android application that uses a sqlite database which is
I have an iPhone application that uses a sqlite3 database for saving data and
I already have an application that uses the SQLite database and a listadapter. I
I have an application that uses a SQLite database and everything works the way
I have a .NET application that uses a sqlite database. In the latest release
I have an application that uses data queries and displays them in a UITableView.

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.