すべてのプロダクト
Search
ドキュメントセンター

DataWorks:CreateConnection

最終更新日:Sep 29, 2026

データソースを追加します。

説明

この API は廃止されました。一時的にアクセス可能ですが、更新やバグ修正対応は一切行われません。代わりに dataworks-public(2020-05-18) - CreateDataSource への移行を推奨します。より強化された機能に加え、サポートも引き続きご利用いただけます。

今すぐお試しください

この API を OpenAPI Explorer でお試しください。手作業による署名は必要ありません。呼び出しに成功すると、入力したパラメーターに基づき、資格情報が組み込まれた SDK コードが自動的に生成されます。このコードをダウンロードしてローカルで使用できます。

テスト

RAM 認証

この操作の認証情報はありません。問題が発生した場合は、アカウントマネージャーにご連絡ください。

リクエストパラメーター

パラメーター

型

必須 / 任意

説明

例

ProjectId

integer

必須

データソースが関連付けられているワークスペースの ID。 ListProjects 操作を呼び出して ID を取得できます。

1

Name

string

必須

データソースの名前。

abc

Description

string

任意

接続文字列の説明。

abc

ConnectionType

string

必須

接続文字列のタイプ。一般的な値は次のとおりです。

  • odps

  • mysql

  • rds

  • oss

  • sqlserver

  • polardb

  • oracle

  • mongodb

  • emr

  • postgresql

  • analyticdb_for_mysql

  • hybriddb_for_postgresql

  • holo

rds

SubType

string

任意

接続文字列のサブタイプ。このパラメーターは、タイプにサブタイプが含まれる場合使用されます。次のタイプとサブタイプがサポートされています。

  • タイプ: rds

  • サブタイプ: mysql、sqlserver、postgresql。

mysql

EnvType

integer

必須

データソースが使用される環境。有効な値: 0、1。値 0 は開発環境を示します。値 1 は本番環境を示します。

1

Content

string

必須

データソースの詳細。一般的なデータソースの詳細の例 (データベース、バケット、ポート、タグ、オーナー、デフォルト、ユーザー名、プロジェクト、エンドポイント、リージョン、接続などのプロパティを含みます):

  • odps

{
  "accessId": "xssssss",
  "accessKey": "xsaxsaxsa",
  "authType": 2,
  "endpoint": "http://service.odps.aliyun.com/api",
  "project": "xsaxsax",
  "tag": "public"
}
  • mysql

{
  "database": "xsaxsa",
  "instanceName": "rm-xsaxsa",
  "password": "xsaxsa",
  "rdsOwnerId": "xasxsa",
  "regionId": "cn-shanghai",
  "tag": "rds",
  "username": "xsaxsa"
}
  • rds

{
  "configType": 1,
  "tag": "rds",
  "database": "xsaxsa",
  "username": "xsaxsa",
  "password": "xssaxsa$32050",
  "instanceName": "rm-xsaxs",
  "rdsOwnerId": "11111111"
}
  • oss

{
  "accessId": "sssssxx",
  "accessKey": "xsaxaxsaxs",
  "bucket": "xsa-xs-xs",
  "endpoint": "http://oss-cn-shanghai.aliyuncs.com",
  "tag": "public"
}
  • sqlserver

{
  "jdbcUrl": "jdbc:sqlserver://xsaxsa-xsaxsa.database.xxx.cn:123;DatabaseName=xsxs-xsxs",
  "password": "sdasda$fs",
  "tag": "public",
  "username": "sxaxacdacdd"
}
  • polardb

{
  "clusterId": "pc-sdadsadsa",
  "database": "dsadsadsa",
  "ownerId": "121212122",
  "password": "sdasdafssa",
  "region": "cn-shanghai",
  "tag": "polardb",
  "username": "asdadsads"
}
  • oracle

{
  "jdbcUrl": "jdbc:oracle:saaa:@xxxxx:1521:PROD",
  "password": "sxasaxsa",
  "tag": "public",
  "username": "sasfadfa"
}
  • mongodb

{
  "address": "[\"xsaxxsa.mongodb.rds.aliyuncs.com:3717\"]",
  "database": "admin",
  "password": "sadsda@",
  "tag": "public",
  "username": "dsadsadas"
}
  • emr

{
  "accessId": "xsaxsa",
  "emrClusterId": "C-dsads",
  "emrResourceQueueName": "default",
  "emrEndpoint": "emr.aliyuncs.com",
  "accessKey": "dsadsad",
  "emrUserId": "224833315798889783",
  "name": "sasdsadsa",
  "emrAccessMode": "simple",
  "region": "cn-shanghai",
  "authType": "2",
  "emrProjectId": "FP-sdadsad"
}
  • postgresql

{
  "jdbcUrl": "jdbc:postgresql://xxxx:1921/ssss",
  "password": "sdadsads",
  "tag": "public",
  "username": "sdsasda"
}
  • analyticdb_for_mysql

{
  "instanceId": "am-sadsada",
  "database": "xsxsx",
  "username": "xsxsa",
  "password": "asdadsa",
  "connectionString": "am-xssxsxs.ads.aliyuncs.com:3306"
}
  • hybriddb_for_postgresql

{
  "connectionString": "gp-xsaxsaxa-master.gpdbmaster.rds.aliyuncs.com",
  "database": "xsaxsaxas",
  "password": "xsaxsaxsa@11",
  "instanceId": "gp-xsaxsaxsa",
  "port": "541132",
  "ownerId": "xsaxsaxsas",
  "username": "sadsad"
}
  • holo

{
  "accessId": "xsaxsaxs",
  "accessKey": "xsaxsaxsa",
  "database": "xsaxsaxsa",
  "instanceId": "xsaxa",
  "tag": "aliyun"
}
  • kafka

{
  "instanceId": "xsax-cn-xsaxsa",
  "regionId": "cn-shanghai",
  "tag": "aliyun",
  "ownerId": "1212121212112"
}

{"database":"dbname","instanceName":"instancename","password":"password","rdsOwnerId":"123","username":"username"}

レスポンスフィールド

フィールド

型

説明

例

object

HttpStatusCode

string

HTTP 状態コード。

200

Data

integer

データソース ID。

123

RequestId

string

リクエスト ID。

0bc141151593763****

Success

boolean

リクエストが成功したかどうかを示します。

true

例

成功レスポンス

JSONJSON

{
  "HttpStatusCode": "200",
  "Data": 123,
  "RequestId": "0bc141151593763****",
  "Success": true
}

エラーコード

HTTP ステータスコード

エラーコード

エラーメッセージ

説明

400 Invalid.Tenant.ConnectionNotExists The connection does not exist.
400 Invalid.Tenant.ProjectNotExists The project does not exist.
400 Invalid.Tenant.UserNotInProject The user is not in the project.
400 ConnectionAlreadyExist The connection with envType %s and name %s already exists.
400 DataSource.CheckRamRoleFailure Failed to check the RAM role. AccountId %s. roleArn %s.
400 DataSource.ConnectionStrProperty.PatternNotMatch The pattern value %s is invalid. The correct pattern is %s.
400 Invalid.DataSource.DataSourceTypeNotSupport The dataSourceType %s and subType %s are not supported.
400 Invalid.Param.Odps.EngineIdOrConnectStrEmpty Either the compute engine ID or the connection string must be specified when data source type is ODPS.
400 MissingParam.ConnectionStr.Property You must specify property %s required by the data source connection string.
400 Invalid.DataSource.DataSourceTypeNotExist The data source type %s does not exist.
403 Invalid.Tenant.UserIsNotProjectOwnerOrAdmin The user is not a project administrator or owner.
403 Invalid.Tenant.UserNotInTenant The user is not in tenant.

完全なリストについては、「エラーコード」をご参照ください。

変更履歴

完全なリストについては、「変更履歴」をご参照ください。