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

# android.database

*** ** * ** ***

Contains classes to explore data returned through a content provider.

If you need to manage data in a private database, use the `https://developer.android.com/reference/android/database/sqlite/package-summary` classes. These classes are used to manage the `https://developer.android.com/reference/android/database/Cursor` object returned from a content provider query. Databases are usually created and opened with `https://developer.android.com/reference/android/content/Context#openOrCreateDatabase(java.lang.String,%20int,%20android.database.sqlite.SQLiteDatabase.CursorFactory)` To make requests through content providers, you can use the `https://developer.android.com/reference/android/content/ContentResolver` class.

All databases are stored on the device in `/data/data/<package_name>/databases`

## Interfaces

|---|---|
| [CrossProcessCursor](https://developer.android.com/reference/android/database/CrossProcessCursor) | A cross process cursor is an extension of a `https://developer.android.com/reference/android/database/Cursor` that also supports usage from remote processes. |
| [Cursor](https://developer.android.com/reference/android/database/Cursor) | This interface provides random read-write access to the result set returned by a database query. |
| [DatabaseErrorHandler](https://developer.android.com/reference/android/database/DatabaseErrorHandler) | An interface to let apps define an action to take when database corruption is detected. |

## Classes

|---|---|
| [AbstractCursor](https://developer.android.com/reference/android/database/AbstractCursor) | This is an abstract cursor class that handles a lot of the common code that all cursors need to deal with and is provided for convenience reasons. |
| [AbstractCursor.SelfContentObserver](https://developer.android.com/reference/android/database/AbstractCursor.SelfContentObserver) | Cursors use this class to track changes others make to their URI. |
| [AbstractWindowedCursor](https://developer.android.com/reference/android/database/AbstractWindowedCursor) | A base class for Cursors that store their data in `https://developer.android.com/reference/android/database/CursorWindow`s. |
| [CharArrayBuffer](https://developer.android.com/reference/android/database/CharArrayBuffer) | This is used for `https://developer.android.com/reference/android/database/Cursor#copyStringToBuffer(int,%20android.database.CharArrayBuffer)` |
| [ContentObservable](https://developer.android.com/reference/android/database/ContentObservable) | A specialization of `https://developer.android.com/reference/android/database/Observable` for `https://developer.android.com/reference/android/database/ContentObserver` that provides methods for sending notifications to a list of `https://developer.android.com/reference/android/database/ContentObserver` objects. |
| [ContentObserver](https://developer.android.com/reference/android/database/ContentObserver) | Receives call backs for changes to content. |
| [CrossProcessCursorWrapper](https://developer.android.com/reference/android/database/CrossProcessCursorWrapper) | Cursor wrapper that implements `https://developer.android.com/reference/android/database/CrossProcessCursor`. |
| [CursorJoiner](https://developer.android.com/reference/android/database/CursorJoiner) | Does a join on two cursors using the specified columns. |
| [CursorWindow](https://developer.android.com/reference/android/database/CursorWindow) | A buffer containing multiple cursor rows. |
| [CursorWrapper](https://developer.android.com/reference/android/database/CursorWrapper) | Wrapper class for Cursor that delegates all calls to the actual cursor object. |
| [DatabaseUtils](https://developer.android.com/reference/android/database/DatabaseUtils) | Static utility methods for dealing with databases and `https://developer.android.com/reference/android/database/Cursor`s. |
| [DatabaseUtils.InsertHelper](https://developer.android.com/reference/android/database/DatabaseUtils.InsertHelper) | *This class was deprecated in API level 17. Use `https://developer.android.com/reference/android/database/sqlite/SQLiteStatement` instead.* |
| [DataSetObservable](https://developer.android.com/reference/android/database/DataSetObservable) | A specialization of `https://developer.android.com/reference/android/database/Observable` for `https://developer.android.com/reference/android/database/DataSetObserver` that provides methods for sending notifications to a list of `https://developer.android.com/reference/android/database/DataSetObserver` objects. |
| [DataSetObserver](https://developer.android.com/reference/android/database/DataSetObserver) | Receives call backs when a data set has been changed, or made invalid. |
| [DefaultDatabaseErrorHandler](https://developer.android.com/reference/android/database/DefaultDatabaseErrorHandler) | Default class used to define the action to take when database corruption is reported by sqlite. |
| [MatrixCursor](https://developer.android.com/reference/android/database/MatrixCursor) | A mutable cursor implementation backed by an array of `Object`s. |
| [MatrixCursor.RowBuilder](https://developer.android.com/reference/android/database/MatrixCursor.RowBuilder) | Builds a row of values using either of these approaches: - Values can be added with explicit column ordering using `https://developer.android.com/reference/android/database/MatrixCursor.RowBuilder#add(java.lang.Object)`, which starts from the left-most column and adds one column value at a time. |
| [MergeCursor](https://developer.android.com/reference/android/database/MergeCursor) | A convenience class that lets you present an array of Cursors as a single linear Cursor. |
| [Observable](https://developer.android.com/reference/android/database/Observable)\<T\> | Provides methods for registering or unregistering arbitrary observers in an `https://developer.android.com/reference/java/util/ArrayList`. |

## Enums

|---|---|
| [CursorJoiner.Result](https://developer.android.com/reference/android/database/CursorJoiner.Result) | The result of a call to next(). |

## Exceptions

|---|---|
| [CursorIndexOutOfBoundsException](https://developer.android.com/reference/android/database/CursorIndexOutOfBoundsException) | An exception indicating that a cursor is out of bounds. |
| [CursorWindowAllocationException](https://developer.android.com/reference/android/database/CursorWindowAllocationException) | This exception is thrown when a CursorWindow couldn't be allocated, most probably due to memory not being available. |
| [SQLException](https://developer.android.com/reference/android/database/SQLException) | An exception that indicates there was an error with SQL parsing or execution. |
| [StaleDataException](https://developer.android.com/reference/android/database/StaleDataException) | This exception is thrown when a Cursor contains stale data and must be requeried before being used again. |

-

  ## Interfaces

  - [CrossProcessCursor](https://developer.android.com/reference/android/database/CrossProcessCursor)
  - [Cursor](https://developer.android.com/reference/android/database/Cursor)
  - [DatabaseErrorHandler](https://developer.android.com/reference/android/database/DatabaseErrorHandler)
-

  ## Classes

  - [AbstractCursor](https://developer.android.com/reference/android/database/AbstractCursor)
  - [AbstractCursor.SelfContentObserver](https://developer.android.com/reference/android/database/AbstractCursor.SelfContentObserver)
  - [AbstractWindowedCursor](https://developer.android.com/reference/android/database/AbstractWindowedCursor)
  - [CharArrayBuffer](https://developer.android.com/reference/android/database/CharArrayBuffer)
  - [ContentObservable](https://developer.android.com/reference/android/database/ContentObservable)
  - [ContentObserver](https://developer.android.com/reference/android/database/ContentObserver)
  - [CrossProcessCursorWrapper](https://developer.android.com/reference/android/database/CrossProcessCursorWrapper)
  - [CursorJoiner](https://developer.android.com/reference/android/database/CursorJoiner)
  - [CursorWindow](https://developer.android.com/reference/android/database/CursorWindow)
  - [CursorWrapper](https://developer.android.com/reference/android/database/CursorWrapper)
  - [DatabaseUtils](https://developer.android.com/reference/android/database/DatabaseUtils)
  - [DatabaseUtils.InsertHelper](https://developer.android.com/reference/android/database/DatabaseUtils.InsertHelper)
  - [DataSetObservable](https://developer.android.com/reference/android/database/DataSetObservable)
  - [DataSetObserver](https://developer.android.com/reference/android/database/DataSetObserver)
  - [DefaultDatabaseErrorHandler](https://developer.android.com/reference/android/database/DefaultDatabaseErrorHandler)
  - [MatrixCursor](https://developer.android.com/reference/android/database/MatrixCursor)
  - [MatrixCursor.RowBuilder](https://developer.android.com/reference/android/database/MatrixCursor.RowBuilder)
  - [MergeCursor](https://developer.android.com/reference/android/database/MergeCursor)
  - [Observable](https://developer.android.com/reference/android/database/Observable)
-

  ## Enums

  - [CursorJoiner.Result](https://developer.android.com/reference/android/database/CursorJoiner.Result)
-

  ## Exceptions

  - [CursorIndexOutOfBoundsException](https://developer.android.com/reference/android/database/CursorIndexOutOfBoundsException)
  - [CursorWindowAllocationException](https://developer.android.com/reference/android/database/CursorWindowAllocationException)
  - [SQLException](https://developer.android.com/reference/android/database/SQLException)
  - [StaleDataException](https://developer.android.com/reference/android/database/StaleDataException)