# BundledSQLiteDriver

Artifact: [androidx.sqlite:sqlite-bundled](https://developer.android.com/jetpack/androidx/releases/sqlite) [View Source](https://cs.android.com/search?q=file:androidx/sqlite/driver/bundled/BundledSQLiteDriver.+class:androidx.sqlite.driver.bundled.BundledSQLiteDriver) Added in [2.5.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.5.0)

*** ** * ** ***

Kotlin \|[Java](https://developer.android.com/reference/androidx/sqlite/driver/bundled/BundledSQLiteDriver "View this page in Java") Common/AllAndroid/JVMNative/C/iOS
- Cmn

  ```
  class BundledSQLiteDriver : SQLiteDriver
  ```
- N

  ```
  actual typealias BundledSQLiteDriver = NativeSQLiteDriver : SQLiteDriver
  ```

*** ** * ** ***

A `https://developer.android.com/reference/kotlin/androidx/sqlite/SQLiteDriver` that uses a bundled version of SQLite included as a native component of this library.

The bundled SQLite used by this driver is compiled in [multi-thread mode](https://www.sqlite.org/threadsafe.html) which means connections opened by the driver are NOT thread-safe. If multiple connections are desired, then a connection pool is required in order for the connections be used in a multi-thread and concurrent environment. If only a single connection is needed then a thread-safe connection can be opened by using the `https://developer.android.com/reference/kotlin/androidx/sqlite/driver/bundled/package-summary#SQLITE_OPEN_FULLMUTEX()` flag. If the connection usage is exclusively single threaded, then no additional configuration is required.

## Summary

| ### Public constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/sqlite/driver/bundled/BundledSQLiteDriver#BundledSQLiteDriver()()` | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/sqlite/driver/bundled/BundledSQLiteDriver#BundledSQLiteDriver()()` | android |

| ### Public functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/driver/bundled/BundledSQLiteDriver#addExtension(kotlin.String)(fileName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Registers a dynamically-linked SQLite extension to load for every subsequent connection opened with this driver. | Cmn android |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/driver/bundled/BundledSQLiteDriver#addExtension(kotlin.String,kotlin.String)(fileName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, entryPoint: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Registers a dynamically-linked SQLite extension to load for every subsequent connection opened with this driver. | Cmn android |
| `open https://developer.android.com/reference/kotlin/androidx/sqlite/SQLiteConnection` | `https://developer.android.com/reference/kotlin/androidx/sqlite/driver/bundled/BundledSQLiteDriver#open(kotlin.String)(fileName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` | Cmn android |
| `https://developer.android.com/reference/kotlin/androidx/sqlite/SQLiteConnection` | `https://developer.android.com/reference/kotlin/androidx/sqlite/driver/bundled/BundledSQLiteDriver#open(kotlin.String,kotlin.Int)(fileName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, flags: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Opens a new database connection. | Cmn android |

| ### Public properties |
|---|---|---|
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/driver/bundled/BundledSQLiteDriver#hasConnectionPool()` Identifies whether the driver has an internal connection pool or not. | android |

| ### Inherited functions |
|---|
| From [androidx.sqlite.SQLiteDriver](https://developer.android.com/reference/kotlin/androidx/sqlite/SQLiteDriver) |---|---|---| | `abstract suspend https://developer.android.com/reference/kotlin/androidx/sqlite/SQLiteConnection` | `https://developer.android.com/reference/kotlin/androidx/sqlite/SQLiteDriver#openAsync(kotlin.String)(fileName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Opens a new database connection asynchronously. | Cmn | |

| ### Inherited properties |
|---|
| From [androidx.sqlite.SQLiteDriver](https://developer.android.com/reference/kotlin/androidx/sqlite/SQLiteDriver) |---|---|---| | `abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/SQLiteDriver#hasConnectionPool()` Identifies whether the driver has an internal connection pool or not. | Cmn | |

## Public constructors

### BundledSQLiteDriver

Cmn Added in [2.5.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.5.0)

```
BundledSQLiteDriver()
```

### BundledSQLiteDriver

android Added in [2.5.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.5.0)

```
BundledSQLiteDriver()
```

## Public functions

### addExtension

Cmn android Added in [2.6.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.6.0)

```
fun addExtension(fileName: String): Unit
```

Registers a dynamically-linked SQLite extension to load for every subsequent connection opened with this driver.

The extension is loaded by SQLite in a platform-specific way. SQLite will attempt to open the file using (e.g. dlopen on POSIX) and look up a native function responsible for initializing the extension. SQLite will derive the entry function from the file name.

It is the developer's responsibility to ensure that the library is actually available with the app. If the file is not available when a connection from this driver is opened, then an `https://developer.android.com/reference/kotlin/androidx/sqlite/SQLiteException` will be thrown during `https://developer.android.com/reference/kotlin/androidx/sqlite/driver/bundled/BundledSQLiteDriver#open(kotlin.String)`.

See also: [Load an extension](https://www.sqlite.org/c3ref/load_extension.html)

| Parameters |
|---|---|
| `fileName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The path to the extension to load. A given file can only be added as an extension once. |

### addExtension

Cmn android Added in [2.6.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.6.0)

```
fun addExtension(fileName: String, entryPoint: String): Unit
```

Registers a dynamically-linked SQLite extension to load for every subsequent connection opened with this driver.

The extension is loaded by SQLite in a platform-specific way. SQLite will attempt to open the file using (e.g. dlopen on POSIX) and look up a native function responsible for initializing the extension. The `https://developer.android.com/reference/kotlin/androidx/sqlite/driver/bundled/BundledSQLiteDriver#addExtension(kotlin.String,kotlin.String)` defines the function name to be invoke to initialize the extension.

It is the developer's responsibility to ensure that the library is actually available with the app. If the file is not available when a connection from this driver is opened, then an `https://developer.android.com/reference/kotlin/androidx/sqlite/SQLiteException` will be thrown during `https://developer.android.com/reference/kotlin/androidx/sqlite/driver/bundled/BundledSQLiteDriver#open(kotlin.String)`.

See also: [Load an extension](https://www.sqlite.org/c3ref/load_extension.html)

| Parameters |
|---|---|
| `fileName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The path to the extension to load. A given file can only be added as an extension once. |
| `entryPoint: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The function name to serve as entry point in the loaded extension library. |

### open

Cmn android Added in [2.5.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.5.0)

```
open fun open(fileName: String): SQLiteConnection
```

### open

Cmn android Added in [2.5.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.5.0)

```
fun open(fileName: String, flags: Int): SQLiteConnection
```

Opens a new database connection.

See also [Opening A New Database Connection](https://www.sqlite.org/c3ref/open.html)

| Parameters |
|---|---|
| `fileName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | Name of the database file. |
| `flags: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Connection open flags. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/sqlite/SQLiteConnection` | the database connection. |

## Public properties

### hasConnectionPool

android

```
open val hasConnectionPool: Boolean
```

Identifies whether the driver has an internal connection pool or not.

A driver with an internal pool should be capable of opening connections that are safe to be used in a multi-thread and concurrent environment whereas a driver that does not have an internal pool will require the application to manage connections in a thread-safe manner. A driver might not report containing a connection pool but might still be safe to be used in a multi-thread environment, such behavior will depend on the driver implementation.

The value returned should be used as a signal to higher abstractions in order to determine if the driver and its connections should be managed by an external connection pool or not.