Skip to content

Commit 871fad4

Browse files
authored
document how to connect to each database + process for new dialects (#742)
1 parent c82b038 commit 871fad4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1143
-448
lines changed

.prettierrc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"singleQuote": true
2+
"singleQuote": true
33
}

docs/associations/_category_.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"position": 5,
2+
"position": 6,
33
"label": "Associations",
44
"collapsible": true,
55
"collapsed": false,

docs/cli.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Sequelize CLI
3-
sidebar_position: 8
3+
sidebar_position: 9
44
---
55

66
:::warning

docs/databases/_category_.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"position": 3,
3+
"label": "Databases",
4+
"collapsible": true,
5+
"collapsed": true,
6+
"link": {
7+
"type": "generated-index"
8+
}
9+
}

docs/databases/_connection-options.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Connection Options are used to configure a connection to the database.
2+
3+
The simplest way to use them is at the root of the configuration object. These options can also be
4+
used in the [`replication`](../other-topics/read-replication.md) option to customize the connection for each replica,
5+
and can be modified by the [`beforeConnect`](../other-topics/hooks.mdx) hook on a connection-by-connection basis.

docs/databases/db2.mdx

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
title: DB2 for LUW
3+
sidebar_position: 1
4+
---
5+
6+
# Sequelize for DB2 for Linux, Unix, and Windows
7+
8+
:::info Version Compatibility
9+
10+
See [Releases](/releases#db2-for-luw-support-table) to see which versions of DB2 for LUW are supported.
11+
12+
:::
13+
14+
To use Sequelize with DB2 for LUW, you need to install the `@sequelize/db2` dialect package:
15+
16+
```bash npm2yarn
17+
npm i @sequelize/db2
18+
```
19+
20+
Then use the `Db2Dialect` class as the dialect option in the Sequelize constructor:
21+
22+
```ts
23+
import { Sequelize } from '@sequelize/core';
24+
import { Db2Dialect } from '@sequelize/db2';
25+
26+
const sequelize = new Sequelize({
27+
dialect: Db2Dialect,
28+
database: 'mydb',
29+
user: 'myuser',
30+
password: 'mypass',
31+
hostname: 'localhost',
32+
port: 50000,
33+
ssl: true,
34+
});
35+
```
36+
37+
## Connection Options
38+
39+
import ConnectionOptions from './_connection-options.md';
40+
41+
<ConnectionOptions />
42+
43+
The following options are accepted by the DB2 for LUW dialect:
44+
45+
| Option | Description |
46+
|------------------------|-------------------------------------------------|
47+
| `database` | ODBC "DATABASE" parameter |
48+
| `username` | ODBC "UID" parameter |
49+
| `password` | ODBC "PWD" parameter |
50+
| `hostname` | ODBC "HOSTNAME" parameter |
51+
| `port` | ODBC "PORT" parameter |
52+
| `ssl` | Sets ODBC "Security" parameter to SSL when true |
53+
| `sslServerCertificate` | ODBC "SSLServerCertificate" parameter |
54+
| `odbcOptions` | Additional ODBC parameters. |

docs/databases/ibmi.mdx

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
title: DB2 for IBM i
3+
sidebar_position: 1
4+
---
5+
6+
# Sequelize for DB2 for IBM i
7+
8+
:::danger
9+
10+
Our implementation of DB2 for IBM i is not integration tested against an actual database.
11+
As such, we cannot guarantee that it will work as expected, nor its stability.
12+
13+
We rely on the community to help us improve this dialect.
14+
15+
:::
16+
17+
:::info Version Compatibility
18+
19+
See [Releases](/releases#db2-for-ibm-i-support-table) to see which versions of DB2 for IBM i are supported.
20+
21+
:::
22+
23+
To use Sequelize with DB2 for IBM i, you need to install the `@sequelize/db2-ibmi` dialect package:
24+
25+
```bash npm2yarn
26+
npm i @sequelize/db2-ibmi
27+
```
28+
29+
Then use the `IbmiDialect` class as the dialect option in the Sequelize constructor:
30+
31+
```ts
32+
import { Sequelize } from '@sequelize/core';
33+
import { IbmiDialect } from '@sequelize/db2-ibmi';
34+
35+
const sequelize = new Sequelize({
36+
dialect: IbmiDialect,
37+
odbcConnectionString: 'DSN=MYDSN;UID=myuser;PWD=mypassword',
38+
connectionTimeout: 60,
39+
});
40+
```
41+
42+
## Connection Options
43+
44+
import ConnectionOptions from './_connection-options.md';
45+
46+
<ConnectionOptions />
47+
48+
The following options are accepted by the DB2 for IBM i dialect:
49+
50+
| Option | Description |
51+
|------------------------|---------------------------------------------------------------------------------------------------------------|
52+
| `connectionTimeout` | The number of seconds to wait for a request on the connection to complete before returning to the application |
53+
| `loginTimeout` | The number of seconds to wait for a login request to complete before returning to the application |
54+
| `odbcConnectionString` | The connection string to connect to the database. If provided, the options below are not necessary. |
55+
| `dataSourceName` | The ODBC "DSN" part of the connection string. |
56+
| `username` | The ODBC "UID" part of the connection string. |
57+
| `system` | The ODBC "SYSTEM" part of the connection string. |
58+
| `password` | The ODBC "PWD" part of the connection string. |

0 commit comments

Comments
 (0)