Skip to content

Commit 7c06df7

Browse files
committed
Add DB2 and IBM i database docs
Add documentation for DB2 for LUW and DB2 for IBM i dialects and a shared connection options include. Each dialect page includes installation instructions, Sequelize initialization examples, and tables of supported connection options; the IBM i page notes lack of integration testing and community-driven support.
1 parent 7115208 commit 7c06df7

File tree

3 files changed

+108
-0
lines changed

3 files changed

+108
-0
lines changed

databases/_connection-options.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
连接选项用于配置与数据库的连接。
2+
3+
最简单的用法是在配置对象的根部直接使用这些选项。这些选项也可以在 [`replication`](../other-topics/read-replication.md) 选项中使用,以自定义每个副本的连接,
4+
并且可以通过 [`beforeConnect`](../other-topics/hooks.mdx) 钩子按连接逐一修改。

databases/db2.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Sequelize 用于 DB2 for Linux、Unix 和 Windows
2+
3+
4+
5+
请参阅 [Releases](/releases#db2-for-luw-support-table) 以了解支持哪些版本的 DB2 for LUW。
6+
7+
8+
要在 DB2 for LUW 上使用 Sequelize,你需要安装 `@sequelize/db2` 方言包:
9+
10+
```bash npm2yarn
11+
npm i @sequelize/db2
12+
```
13+
14+
15+
然后在 Sequelize 构造函数中使用 `Db2Dialect` 作为 dialect 选项:
16+
17+
```ts
18+
import { Sequelize } from '@sequelize/core';
19+
import { Db2Dialect } from '@sequelize/db2';
20+
21+
const sequelize = new Sequelize({
22+
dialect: Db2Dialect,
23+
database: 'mydb',
24+
user: 'myuser',
25+
password: 'mypass',
26+
hostname: 'localhost',
27+
port: 50000,
28+
ssl: true,
29+
});
30+
```
31+
32+
33+
## 连接选项
34+
35+
import ConnectionOptions from './_connection-options.md';
36+
37+
<ConnectionOptions />
38+
39+
40+
DB2 for LUW 方言支持以下选项:
41+
42+
| 选项 | 说明 |
43+
| ---------------------- | ----------------------------------------------- |
44+
| `database` | ODBC "DATABASE" 参数 |
45+
| `username` | ODBC "UID" 参数 |
46+
| `password` | ODBC "PWD" 参数 |
47+
| `hostname` | ODBC "HOSTNAME" 参数 |
48+
| `port` | ODBC "PORT" 参数 |
49+
| `ssl` | 当为 true 时,将 ODBC "Security" 参数设置为 SSL |
50+
| `sslServerCertificate` | ODBC "SSLServerCertificate" 参数 |
51+
| `odbcOptions` | 其他 ODBC 参数 |

databases/ibmi.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Sequelize 用于 DB2 for IBM i
2+
3+
4+
5+
我们对 DB2 for IBM i 的实现并未在真实数据库上进行集成测试。
6+
因此,我们无法保证其能如预期工作,也无法保证其稳定性。
7+
8+
我们依赖社区的帮助来改进此方言。
9+
10+
11+
12+
请参阅 [Releases](/releases#db2-for-ibm-i-support-table) 以了解支持哪些版本的 DB2 for IBM i。
13+
14+
15+
要在 DB2 for IBM i 上使用 Sequelize,你需要安装 `@sequelize/db2-ibmi` 方言包:
16+
17+
```bash npm2yarn
18+
npm i @sequelize/db2-ibmi
19+
```
20+
21+
22+
然后在 Sequelize 构造函数中使用 `IbmiDialect` 作为 dialect 选项:
23+
24+
```ts
25+
import { Sequelize } from '@sequelize/core';
26+
import { IbmiDialect } from '@sequelize/db2-ibmi';
27+
28+
const sequelize = new Sequelize({
29+
dialect: IbmiDialect,
30+
odbcConnectionString: 'DSN=MYDSN;UID=myuser;PWD=mypassword',
31+
connectionTimeout: 60,
32+
});
33+
```
34+
35+
36+
## 连接选项
37+
38+
import ConnectionOptions from './_connection-options.md';
39+
40+
<ConnectionOptions />
41+
42+
43+
DB2 for IBM i 方言支持以下选项:
44+
45+
| 选项 | 说明 |
46+
| ---------------------- | ------------------------------------------------------------------------------------------------------------- |
47+
| `connectionTimeout` | 等待连接上请求完成后返回应用的秒数 |
48+
| `loginTimeout` | 等待登录请求完成后返回应用的秒数 |
49+
| `odbcConnectionString` | 用于连接数据库的连接字符串。如果提供此项,下方选项可省略。 |
50+
| `dataSourceName` | 连接字符串中的 ODBC "DSN" 部分。 |
51+
| `username` | 连接字符串中的 ODBC "UID" 部分。 |
52+
| `system` | 连接字符串中的 ODBC "SYSTEM" 部分。 |
53+
| `password` | 连接字符串中的 ODBC "PWD" 部分。 |

0 commit comments

Comments
 (0)