# Databases

> The database drivers built into Elide: embedded SQLite, PostgreSQL and MySQL from JavaScript and TypeScript, Python's sqlite3, and JDBC from Java and Kotlin.

Elide includes three database drivers for JavaScript and TypeScript. Import the one you need; there is nothing to
install and no `Elide.db` global.

| Module | Database | API | Placeholders | Page |
| --- | --- | --- | --- | --- |
| `elide:sqlite` | SQLite file or in-memory | Synchronous | `?`, `?1`, `$name` | [SQLite](https://elide.help/docs/api-sqlite) |
| `elide:postgres` | PostgreSQL server | Promises, pooled | `$1` or `?` | [PostgreSQL](https://elide.help/docs/api-postgres) |
| `elide:mysql` | MySQL server | Promises, pooled | `?` | [MySQL](https://elide.help/docs/api-mysql) |

```javascript
import { Database } from "elide:sqlite";

const db = new Database(":memory:");
db.exec("CREATE TABLE notes (body TEXT)");
db.prepare("INSERT INTO notes VALUES (?)").run("hello");
console.log(db.query("SELECT body FROM notes").all());
```

`node:sqlite` and `bun:sqlite` load the same module as `elide:sqlite`; Node's `DatabaseSync` isn't provided (see
[SQLite](https://elide.help/docs/api-sqlite#nodesqlite-and-bunsqlite)). `elide:postgres` and `elide:mysql` ship TypeScript declarations in
`@elide-dev/types`; `elide:sqlite` has none yet (see [TypeScript and modules](https://elide.help/docs/typescript-and-modules)).

## Other languages

| Language | Use |
| --- | --- |
| Python | The standard [`sqlite3`](https://docs.python.org/3/library/sqlite3.html) module, after `elide setup python` |
| Java, Kotlin | JDBC, with the driver as a Maven dependency, such as `org.xerial:sqlite-jdbc` or `org.postgresql:postgresql` |

The JavaScript drivers aren't on a JVM program's classpath: declare the JDBC driver like any other library (see
[Maven dependencies](https://elide.help/docs/toolchain/jvm/maven)).

## Samples

- [Embedded SQLite](https://elide.help/docs/code-samples#embedded-sqlite)
- [SQLite transactions](https://elide.help/docs/code-samples#sqlite-transactions)
- [PostgreSQL queries](https://elide.help/docs/code-samples#postgresql-queries)
