| 1 | [**@lancedb/lancedb**](../README.md) • **Docs** |
| 2 | |
| 3 | *** |
| 4 | |
| 5 | [@lancedb/lancedb](../globals.md) / connect |
| 6 | |
| 7 | # Function: connect() |
| 8 | |
| 9 | ## connect(uri, opts) |
| 10 | |
| 11 | > **connect**(`uri`, `opts`?): `Promise`<[`Connection`](../classes/Connection.md)> |
| 12 | |
| 13 | Connect to a LanceDB instance at the given URI. |
| 14 | |
| 15 | Accepted formats: |
| 16 | |
| 17 | - `/path/to/database` - local database |
| 18 | - `s3://bucket/path/to/database` or `gs://bucket/path/to/database` - database on cloud storage |
| 19 | - `db://host:port` - remote database (LanceDB cloud) |
| 20 | |
| 21 | ### Parameters |
| 22 | |
| 23 | • **uri**: `string` |
| 24 | |
| 25 | The uri of the database. If the database uri starts |
| 26 | with `db://` then it connects to a remote database. |
| 27 | |
| 28 | • **opts?**: `Partial`<[`ConnectionOptions`](../interfaces/ConnectionOptions.md) \| `RemoteConnectionOptions`> |
| 29 | |
| 30 | ### Returns |
| 31 | |
| 32 | `Promise`<[`Connection`](../classes/Connection.md)> |
| 33 | |
| 34 | ### See |
| 35 | |
| 36 | [ConnectionOptions](../interfaces/ConnectionOptions.md) for more details on the URI format. |
| 37 | |
| 38 | ### Examples |
| 39 | |
| 40 | ```ts |
| 41 | const conn = await connect("/path/to/database"); |
| 42 | ``` |
| 43 | |
| 44 | ```ts |
| 45 | const conn = await connect( |
| 46 | "s3://bucket/path/to/database", |
| 47 | {storageOptions: {timeout: "60s"} |
| 48 | }); |
| 49 | ``` |
| 50 | |
| 51 | ## connect(opts) |
| 52 | |
| 53 | > **connect**(`opts`): `Promise`<[`Connection`](../classes/Connection.md)> |
| 54 | |
| 55 | Connect to a LanceDB instance at the given URI. |
| 56 | |
| 57 | Accepted formats: |
| 58 | |
| 59 | - `/path/to/database` - local database |
| 60 | - `s3://bucket/path/to/database` or `gs://bucket/path/to/database` - database on cloud storage |
| 61 | - `db://host:port` - remote database (LanceDB cloud) |
| 62 | |
| 63 | ### Parameters |
| 64 | |
| 65 | • **opts**: `Partial`<[`ConnectionOptions`](../interfaces/ConnectionOptions.md) \| `RemoteConnectionOptions`> & `object` |
| 66 | |
| 67 | ### Returns |
| 68 | |
| 69 | `Promise`<[`Connection`](../classes/Connection.md)> |
| 70 | |
| 71 | ### See |
| 72 | |
| 73 | [ConnectionOptions](../interfaces/ConnectionOptions.md) for more details on the URI format. |
| 74 | |
| 75 | ### Example |
| 76 | |
| 77 | ```ts |
| 78 | const conn = await connect({ |
| 79 | uri: "/path/to/database", |
| 80 | storageOptions: {timeout: "60s"} |
| 81 | }); |
| 82 | ``` |