更新时间:2026-01-30 GMT+08:00

创建连接

功能介绍

创建连接接口。

请求参数

响应参数

状态码:200

状态码:400

状态码:500

请求示例

创建一个名为mysql_link的数据连接。

POST /v1.1/1551c7f6c808414d8e9f3c514a170f2e/clusters/6ec9a0a4-76be-4262-8697-e7af1fac7920/cdm/link

{
  "links" : [ {
    "link-config-values" : {
      "configs" : [ {
        "inputs" : [ {
          "name" : "linkConfig.databaseType",
          "value" : "MYSQL"
        }, {
          "name" : "linkConfig.host",
          "value" : "100.94.8.163"
        }, {
          "name" : "linkConfig.port",
          "value" : "3306"
        }, {
          "name" : "linkConfig.database",
          "value" : "DB_name"
        }, {
          "name" : "linkConfig.username",
          "value" : "username"
        }, {
          "name" : "linkConfig.password",
          "value" : "DB_password"
        }, {
          "name" : "linkConfig.fetchSize",
          "value" : "100000"
        }, {
          "name" : "linkConfig.usingNative",
          "value" : "false"
        } ],
        "name" : "linkConfig"
      } ]
    },
    "name" : "mysql_link",
    "creation-date" : 1496654788622,
    "connector-name" : "generic-jdbc-connector",
    "update-date" : 1496654788622,
    "enabled" : true
  } ]
}

响应示例

状态码:200

OK。

{
  "name" : "rdb_link",
  "validation-result" : [ { } ]
}

状态码:400

请求错误。

{
  "code" : "Cdm.0315",
  "errCode" : "Cdm.0315",
  "message" : "Link name [ftp_link] already exist or created by other user.",
  "externalMessage" : "Link name [ftp_link] already exist or created by other user."
}

状态码:500

服务内部错误,具体返回错误码请参考错误码。

{
  "validation-result" : [ {
    "linkConfig" : [ {
      "message" : "Can't connect to the database with given credentials: The authentication type 12 is not supported. Check that you have configured the pg_hba.conf file to include the client's IP address or subnet, and that it is using an authentication scheme supported by the driver.",
      "status" : "ERROR"
    } ]
  } ]
}

状态码

错误码

请参见错误码