# Threadsafe SQLite

DevFeed: [Threadsafe SQLite](<https://devfeed.tech/articles/threadsafe-sqlite-19557.md>)

Original publisher: [Read original article](<https://www.codenameone.com/blog/threadsafe-sqlite/>)

Author: Shai Almog

Published: 2017-05-09T00:00:00Z

Content type: release

Language: en

Sources: [CodeName One](<https://devfeed.tech/sources/codename-one.md>)

Topics: [SQLite](<https://devfeed.tech/topics/sqlite.md>), [Database](<https://devfeed.tech/topics/database.md>), [SQL](<https://devfeed.tech/topics/sql.md>), [iOS](<https://devfeed.tech/topics/ios.md>), [ui](<https://devfeed.tech/topics/ui.md>)

Tags: [database](<https://devfeed.tech/tags/database.md>), [ios](<https://devfeed.tech/tags/ios.md>), [sql](<https://devfeed.tech/tags/sql.md>), [sqlite](<https://devfeed.tech/tags/sqlite.md>), [ui](<https://devfeed.tech/tags/ui.md>)

## AI overview

The article introduces a threadsafe Database API that serializes database access on a single database thread. It is intended to avoid unsafe SQLite access on iOS and remove the need to use SQLite on the event-dispatch thread, which could cause UI stuttering during SQL operations.

## Source excerpt

One of the main reasons for the thread API I discussed yesterday is a new threadsafe Database API. This new API allows you to wrap your Database instance with a thread that will hide all access to the database and implicitly make it threadsafe by serializing all requests to a single database thread. This also has the side effect of removing the hack of working with sqlite on the EDT which could sometimes cause a stutter in the UI when performing SQL. In fact, that was the chief motivation for this particular enhancement!