[ Web Proxy ]
URL:
Viewing: https://developer.android.com/reference/androidx/sqlite/SQLiteConnection [Back]  [Original]

SQLiteConnection  |  API reference  |  Android Developers Skip to main content
Essentials Design & Plan Develop Google Play Blog
Search:
Android Studio
Android Developers [Android Developers]
Stay organized with collections Save and categorize content based on your preferences.

SQLiteConnection


public interface SQLiteConnection extends AutoCloseable

Known direct subclasses
SupportSQLiteConnection

A SQLiteConnection implemented by androidx.sqlite.db.SupportSQLiteDatabase and that uses the Android's SQLite through the SupportSQLite APIs.


SQLite connection definition.

A connection to a database is a resource that must be released once it is no longer needed via its close function.

See also Database Connection

Summary

Public methods

abstract void

Closes the database connection.

default boolean

Returns true if the connection has an active transaction, false otherwise.

abstract @NonNull SQLiteStatement

Prepares a new SQL statement.

Extension functions

default final void

Executes a single SQL statement that returns no values.

default final void
SQLiteAsync.executeSQL(
    @NonNull SQLiteConnection receiver,
    @NonNull String sql
)

Executes a single SQL statement that returns no values.

default final @NonNull SQLiteStatement
SQLiteAsync.prepare(
    @NonNull SQLiteConnection receiver,
    @NonNull String sql
)

Prepares a new SQL statement.

Public methods

close

Added in 2.5.0
abstract void close()

Closes the database connection.

Once a connection is closed it should no longer be used. Calling this function on an already closed database connection is a no-op.

inTransaction

Added in 2.6.0
default boolean inTransaction()

Returns true if the connection has an active transaction, false otherwise.

prepare

Added in 2.5.0
abstract @NonNull SQLiteStatement prepare(@NonNull String sql)

Prepares a new SQL statement.

See also Compiling a SQL statement

Parameters
@NonNull String sql

the SQL statement to prepare

Returns
@NonNull SQLiteStatement

the prepared statement.

Extension functions

SQLite.execSQL

default final void SQLite.execSQL(@NonNull SQLiteConnection receiver, @NonNull String sql)

Executes a single SQL statement that returns no values.

SQLiteAsync.executeSQL

default final void SQLiteAsync.executeSQL(
    @NonNull SQLiteConnection receiver,
    @NonNull String sql
)

Executes a single SQL statement that returns no values.

On web targets this function is asynchronous while for non-web it is synchronous.

SQLiteAsync.prepare

default final @NonNull SQLiteStatement SQLiteAsync.prepare(
    @NonNull SQLiteConnection receiver,
    @NonNull String sql
)

Prepares a new SQL statement.

On web targets this function is asynchronous while for non-web it is synchronous.

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2026-06-24 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-06-24 UTC."],[],[]]

Web Proxy Viewer  |  New URL  |  Original Page