You can call this operation to test database connectivity by using a gateway.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes ConnectDatabase

The operation that you want to perform. Set the value to ConnectDatabase.

DbPassword String Yes password

The password used to access the database.

DbType String Yes MySQL

The type of the database.

Note Only MySQL databases are supported.
DbUserName String Yes dg_test

The username used to access the database.

GatewayId String Yes dg-yhss6sdlaffaq68

The ID of the gateway.

Host String Yes 11.163.23.109

The address of the database accessed by using the host where the gateway resides.

Port Integer Yes 3440

The port of the database accessed by using the host where the gateway resides.

Response parameters

Parameter Type Example Description
Code String OK

The status code.

Data String xxx

The returned result.

ErrorMsg String None

The error message.

RequestId String EAF2AA07-860D-43DA-BEE8-1E43AAE024DG

The ID of the request.

Success Boolean true

Indicates whether the call is successful.

Examples

Sample requests


http(s)://dg.[regionId].aliyuncs.com/? Action=ConnectDatabase
&DbPassword=password
&DbType=MySQL
&DbUserName=dg_test
&GatewayId=dg-yhss6sdlaffaq68
&Host=11.163.23.109
&Port=3440
&<Common request parameters>

Sample success responses

XML format

<ConnectDatabaseResponse>
      <RequestId>EAF2AA07-860D-43DA-BEE8-1E43AAE024DG</RequestId>
</ConnectDatabaseResponse>

JSON format

{
	"RequestId":"EAF2AA07-860D-43DA-BEE8-1E43AAE024DG"
}

Error codes

For a list of error codes, visit the API Error Center.