[API reference](https://evolu.dev/docs/api-reference) › [@evolu/sqlite-wasm](https://evolu.dev/docs/api-reference/sqlite-wasm) › createSqliteDatabase

```ts
function createSqliteDatabase(
  deps: SqliteWasmDep,
): (options: SqliteDatabaseOptions) => Result<SqliteDatabase, SqliteError>;
```

Defined in: [packages/sqlite-wasm/src/Database.ts:768](https://github.com/evoluhq/evolu/blob/bc4578a260dd15d5bbf94b83765ca05984d194cb/packages/sqlite-wasm/src/Database.ts#L768)

Opens a database.

With a wrong key or a file that is not a database, it fails with
SQLITE_NOTADB, or with SQLITE_CORRUPT for a wrong key and a hot journal whose
first record is not page 1. An encrypted database opened without its key
while it has a hot journal that records pages fails with SQLITE_CANTOPEN,
caused by the codec's [SqliteEncryptionUnsupportedError](https://evolu.dev/docs/api-reference/sqlite-wasm/interfaces/SqliteEncryptionUnsupportedError), and the
journal stays for the key. A leftover journal that is not hot, such as one
`journal_mode = PERSIST` or TRUNCATE keeps, gives SQLITE_NOTADB, as no
journal does. For encrypted databases that 2.2.4 may have keyed, use
[createEncryptedSqliteDatabase](https://evolu.dev/docs/api-reference/sqlite-wasm/functions/createEncryptedSqliteDatabase).