Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

# android.database.sqlite

*** ** * ** ***

Contains the SQLite database management classes that an application would use to manage its own private database.


Applications use these classes to manage private databases. If creating a
content provider, you will probably have to use these classes to create and
manage your own database to store content. See [Content Providers](https://developer.android.com/guide/topics/providers/content-providers)
to learn the conventions for implementing a content provider. If you are working
with data sent to you by a provider, you do not use these SQLite classes, but
instead use the generic `https://developer.android.com/reference/android/database/package-summary` classes.

The Android SDK and Android emulators both include the
[sqlite3](https://developer.android.com/studio/command-line/sqlite3) command-line
database tool. On your development machine, run the tool from the
`platform-tools/` folder of your SDK. On the emulator, run the tool
with adb shell, for example, `adb shell sqlite3`.

The version of SQLite depends on the version of Android. In the past,
SQLite upgrades have been delivered as part of a new API level, but more
recently SQLite may be upgraded within an API level (as with API 34).
Note that patch-level upgrades (e.g. from 3.44.0 to 3.44.3) are not
reported here. If an Android release is not in the table, it uses the
version of SQLite from the next-lower Android release that is listed.
See the following table:

| Android API | SQLite Version |
|---|---|
| API 37 | 3.50 |
| API 36.1 | 3.50 |
| API 35 | 3.44 |
| API 34 | 3.42 |
| API 34 | 3.39 |
| API 33 | 3.32 |
| API 32 | 3.32 |
| API 31 | 3.32 |
| API 30 | 3.28 |
| API 28 | 3.22 |
| API 27 | 3.19 |
| API 26 | 3.18 |
| API 24 | 3.9 |
| API 21 | 3.8 |
| API 11 | 3.7 |
| API 8 | 3.6 |
| API 3 | 3.5 |
| API 1 | 3.4 |

Some device manufacturers include different versions of SQLite on their devices.
There are two ways to programmatically determine the version number.

- If available, use the sqlite3 tool, for example: `adb shell sqlite3 --version`.
- Create and query an in-memory database as shown in the following code sample:

  ```
      String query = "select sqlite_version() AS sqlite_version";
      SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(":memory:", null);
      Cursor cursor = db.rawQuery(query, null);
      String sqliteVersion = "";
      try {
          if (cursor.moveToNext()) {
              sqliteVersion = cursor.getString(0);
          }
      } finally {
          cursor.close();
      }
  ```

## Interfaces

|---|---|
| [SQLiteCursorDriver](https://developer.android.com/reference/android/database/sqlite/SQLiteCursorDriver) | A driver for SQLiteCursors that is used to create them and gets notified by the cursors it creates on significant events in their lifetimes. |
| [SQLiteDatabase.CursorFactory](https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.CursorFactory) | Used to allow returning sub-classes of `https://developer.android.com/reference/android/database/Cursor` when calling query. |
| [SQLiteTransactionListener](https://developer.android.com/reference/android/database/sqlite/SQLiteTransactionListener) | A listener for transaction events. |

## Classes

|---|---|
| [SQLiteClosable](https://developer.android.com/reference/android/database/sqlite/SQLiteClosable) | An object created from a SQLiteDatabase that can be closed. |
| [SQLiteCursor](https://developer.android.com/reference/android/database/sqlite/SQLiteCursor) | A Cursor implementation that exposes results from a query on a `https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase`. |
| [SQLiteDatabase](https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase) | Exposes methods to manage a SQLite database. |
| [SQLiteDatabase.OpenParams](https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.OpenParams) | Wrapper for configuration parameters that are used for opening `https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase` |
| [SQLiteDatabase.OpenParams.Builder](https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.OpenParams.Builder) | Builder for `https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.OpenParams`. |
| [SQLiteOpenHelper](https://developer.android.com/reference/android/database/sqlite/SQLiteOpenHelper) | A helper class to manage database creation and version management. |
| [SQLiteProgram](https://developer.android.com/reference/android/database/sqlite/SQLiteProgram) | A base class for compiled SQLite programs. |
| [SQLiteQuery](https://developer.android.com/reference/android/database/sqlite/SQLiteQuery) | Represents a query that reads the resulting rows into a `https://developer.android.com/reference/android/database/sqlite/SQLiteQuery`. |
| [SQLiteQueryBuilder](https://developer.android.com/reference/android/database/sqlite/SQLiteQueryBuilder) | This is a convenience class that helps build SQL queries to be sent to `https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase` objects. |
| [SQLiteRawStatement](https://developer.android.com/reference/android/database/sqlite/SQLiteRawStatement) | A `https://developer.android.com/reference/android/database/sqlite/SQLiteRawStatement` represents a SQLite prepared statement. |
| [SQLiteStatement](https://developer.android.com/reference/android/database/sqlite/SQLiteStatement) | Represents a statement that can be executed against a database. |

## Exceptions

|---|---|
| [SQLiteAbortException](https://developer.android.com/reference/android/database/sqlite/SQLiteAbortException) | An exception that indicates that the SQLite program was aborted. |
| [SQLiteAccessPermException](https://developer.android.com/reference/android/database/sqlite/SQLiteAccessPermException) | This exception class is used when sqlite can't access the database file due to lack of permissions on the file. |
| [SQLiteBindOrColumnIndexOutOfRangeException](https://developer.android.com/reference/android/database/sqlite/SQLiteBindOrColumnIndexOutOfRangeException) | Thrown if the bind or column parameter index is out of range. |
| [SQLiteBlobTooBigException](https://developer.android.com/reference/android/database/sqlite/SQLiteBlobTooBigException) |   |
| [SQLiteCantOpenDatabaseException](https://developer.android.com/reference/android/database/sqlite/SQLiteCantOpenDatabaseException) |   |
| [SQLiteConstraintException](https://developer.android.com/reference/android/database/sqlite/SQLiteConstraintException) | An exception that indicates that an integrity constraint was violated. |
| [SQLiteDatabaseCorruptException](https://developer.android.com/reference/android/database/sqlite/SQLiteDatabaseCorruptException) | An exception that indicates that the SQLite database file is corrupt. |
| [SQLiteDatabaseLockedException](https://developer.android.com/reference/android/database/sqlite/SQLiteDatabaseLockedException) | Thrown if the database engine was unable to acquire the database locks it needs to do its job. |
| [SQLiteDatatypeMismatchException](https://developer.android.com/reference/android/database/sqlite/SQLiteDatatypeMismatchException) |   |
| [SQLiteDiskIOException](https://developer.android.com/reference/android/database/sqlite/SQLiteDiskIOException) | Indicates that an IO error occurred while accessing the SQLite database file. |
| [SQLiteDoneException](https://developer.android.com/reference/android/database/sqlite/SQLiteDoneException) | An exception that indicates that the SQLite program is done. |
| [SQLiteException](https://developer.android.com/reference/android/database/sqlite/SQLiteException) | A SQLite exception that indicates there was an error with SQL parsing or execution. |
| [SQLiteFullException](https://developer.android.com/reference/android/database/sqlite/SQLiteFullException) | An exception that indicates that the SQLite database is full. |
| [SQLiteMisuseException](https://developer.android.com/reference/android/database/sqlite/SQLiteMisuseException) | This error can occur if the application creates a SQLiteStatement object and allows multiple threads in the application use it at the same time. |
| [SQLiteOutOfMemoryException](https://developer.android.com/reference/android/database/sqlite/SQLiteOutOfMemoryException) |   |
| [SQLiteReadOnlyDatabaseException](https://developer.android.com/reference/android/database/sqlite/SQLiteReadOnlyDatabaseException) |   |
| [SQLiteTableLockedException](https://developer.android.com/reference/android/database/sqlite/SQLiteTableLockedException) |   |

-

  ## Interfaces

  - [SQLiteCursorDriver](https://developer.android.com/reference/android/database/sqlite/SQLiteCursorDriver)
  - [SQLiteDatabase.CursorFactory](https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.CursorFactory)
  - [SQLiteTransactionListener](https://developer.android.com/reference/android/database/sqlite/SQLiteTransactionListener)
-

  ## Classes

  - [SQLiteClosable](https://developer.android.com/reference/android/database/sqlite/SQLiteClosable)
  - [SQLiteCursor](https://developer.android.com/reference/android/database/sqlite/SQLiteCursor)
  - [SQLiteDatabase](https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase)
  - [SQLiteDatabase.OpenParams](https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.OpenParams)
  - [SQLiteDatabase.OpenParams.Builder](https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.OpenParams.Builder)
  - [SQLiteOpenHelper](https://developer.android.com/reference/android/database/sqlite/SQLiteOpenHelper)
  - [SQLiteProgram](https://developer.android.com/reference/android/database/sqlite/SQLiteProgram)
  - [SQLiteQuery](https://developer.android.com/reference/android/database/sqlite/SQLiteQuery)
  - [SQLiteQueryBuilder](https://developer.android.com/reference/android/database/sqlite/SQLiteQueryBuilder)
  - [SQLiteRawStatement](https://developer.android.com/reference/android/database/sqlite/SQLiteRawStatement)
  - [SQLiteStatement](https://developer.android.com/reference/android/database/sqlite/SQLiteStatement)
-

  ## Exceptions

  - [SQLiteAbortException](https://developer.android.com/reference/android/database/sqlite/SQLiteAbortException)
  - [SQLiteAccessPermException](https://developer.android.com/reference/android/database/sqlite/SQLiteAccessPermException)
  - [SQLiteBindOrColumnIndexOutOfRangeException](https://developer.android.com/reference/android/database/sqlite/SQLiteBindOrColumnIndexOutOfRangeException)
  - [SQLiteBlobTooBigException](https://developer.android.com/reference/android/database/sqlite/SQLiteBlobTooBigException)
  - [SQLiteCantOpenDatabaseException](https://developer.android.com/reference/android/database/sqlite/SQLiteCantOpenDatabaseException)
  - [SQLiteConstraintException](https://developer.android.com/reference/android/database/sqlite/SQLiteConstraintException)
  - [SQLiteDatabaseCorruptException](https://developer.android.com/reference/android/database/sqlite/SQLiteDatabaseCorruptException)
  - [SQLiteDatabaseLockedException](https://developer.android.com/reference/android/database/sqlite/SQLiteDatabaseLockedException)
  - [SQLiteDatatypeMismatchException](https://developer.android.com/reference/android/database/sqlite/SQLiteDatatypeMismatchException)
  - [SQLiteDiskIOException](https://developer.android.com/reference/android/database/sqlite/SQLiteDiskIOException)
  - [SQLiteDoneException](https://developer.android.com/reference/android/database/sqlite/SQLiteDoneException)
  - [SQLiteException](https://developer.android.com/reference/android/database/sqlite/SQLiteException)
  - [SQLiteFullException](https://developer.android.com/reference/android/database/sqlite/SQLiteFullException)
  - [SQLiteMisuseException](https://developer.android.com/reference/android/database/sqlite/SQLiteMisuseException)
  - [SQLiteOutOfMemoryException](https://developer.android.com/reference/android/database/sqlite/SQLiteOutOfMemoryException)
  - [SQLiteReadOnlyDatabaseException](https://developer.android.com/reference/android/database/sqlite/SQLiteReadOnlyDatabaseException)
  - [SQLiteTableLockedException](https://developer.android.com/reference/android/database/sqlite/SQLiteTableLockedException)