> ## Documentation Index
> Fetch the complete documentation index at: https://rpa.bazhuayu.com/helpcenter/llms.txt
> Use this file to discover all available pages before exploring further.

# 连接数据库

## 指令说明

**描述：** 连接到指定的数据库

## 参数说明

<Tabs>
  <Tab title="常规">
    <img src="https://mintcdn.com/bazhuayu-rpa-docs/QLw4prvAN-mejJU5/helpcenter/commands/database/images/connecttodatabasecommand-01.png?fit=max&auto=format&n=QLw4prvAN-mejJU5&q=85&s=5992ef0a2a6b59676b3f6096394954f7" alt="连接数据库指令参数面板" width="647" height="469" data-path="helpcenter/commands/database/images/connecttodatabasecommand-01.png" />

    | 参数          | 说明                                                                                           |
    | ----------- | -------------------------------------------------------------------------------------------- |
    | **数据库类型**   | 选择数据库的类型：SQLServer、Mysql、PostgreSQL                                                          |
    | **数据库连接方式** | 请选择数据库连接方式： 数据库连接字符串：、 数据库配置向导：根据字段要求填写各项数据库参数（推荐使用）                                         |
    | **连接字符串**   | 以Mysql为例，连接字符串样式为： Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword; |
    | **主机地址**    | 输入host主机地址                                                                                   |
    | **端口**      | 输入数据库端口                                                                                      |
    | **用户名**     | 输入用户名user                                                                                    |
    | **密码**      | 输入数据库登录密码                                                                                    |
    | **数据库名称**   | 输入或选择数据库名称                                                                                   |
  </Tab>

  <Tab title="高级">
    本指令暂无高级参数。
  </Tab>
</Tabs>

## 使用示例

<img src="https://mintcdn.com/bazhuayu-rpa-docs/QLw4prvAN-mejJU5/helpcenter/commands/database/images/connecttodatabasecommand-04.png?fit=max&auto=format&n=QLw4prvAN-mejJU5&q=85&s=692d00d16abcf47cb7bc4ad2c124a9f1" alt="连接数据库使用示例" width="645" height="692" data-path="helpcenter/commands/database/images/connecttodatabasecommand-04.png" />

<img src="https://mintcdn.com/bazhuayu-rpa-docs/QLw4prvAN-mejJU5/helpcenter/commands/database/images/connecttodatabasecommand-03.png?fit=max&auto=format&n=QLw4prvAN-mejJU5&q=85&s=a0a1857c5161f7f7c6097d83da6c3217" alt="连接数据库使用示例 - 流程搭建" width="649" height="151" data-path="helpcenter/commands/database/images/connecttodatabasecommand-03.png" />

**该流程执行逻辑：**

使用【连接数据库】指令配置Mysql连接，使用「数据库配置向导」方式，输入对应的数据库配置信息，并保存到数据库对象；并打印对象；

### 效果展示

<img src="https://mintcdn.com/bazhuayu-rpa-docs/At1Bhn6G7IYQARg7/helpcenter/commands/database/images/connecttodatabasecommand-05.png?fit=max&auto=format&n=At1Bhn6G7IYQARg7&q=85&s=ab5e1727f0a2018e3a6e3e5bc54e294d" alt="连接数据库使用示例 - 效果展示" width="1340" height="181" data-path="helpcenter/commands/database/images/connecttodatabasecommand-05.png" />

<Info>
  使用指令过程中遇到问题？前往 [八爪鱼RPA 开发者社区问答板块](https://rpa.bazhuayu.com/community/questions) 提问，获取官方与社区帮助。
</Info>
