Skip to content

Commit

Permalink
use @db/sqlite example
Browse files Browse the repository at this point in the history
  • Loading branch information
boda-sh authored Nov 21, 2024
1 parent 5f6a868 commit b9d556b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions runtime/tutorials/connecting_to_databases.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,17 @@ There are two primary solutions to connect to SQLite in Deno:

### Connect to SQLite with the FFI Module

[sqlite3](https://deno.land/x/sqlite3) provides JavaScript bindings to the
[@db/sqlite](https://jsr.io/@db/sqlite) provides JavaScript bindings to the
SQLite3 C API, using [Deno FFI](../reference/deno_namespace_apis.md#ffi).

```ts
import { Database } from "https://deno.land/x/sqlite3@LATEST_VERSION/mod.ts";
import { Database } from "jsr:@db/[email protected]";

const db = new Database("test.db");

const [version] = db.prepare("select sqlite_version()").value<[string]>()!;
console.log(version);

db.close();
```

Expand Down

0 comments on commit b9d556b

Please sign in to comment.