PolarDB for MySQL & PostgreSQL

Updated at: 2024-11-07 02:17

Property definition

  • Data source type: polardb

  • Supported configuration modes (ConnectionPropertiesMode):

    • Connection string mode (UrlMode)

    • Instance mode (InstanceMode)

Instance mode of the current Alibaba Cloud account

Parameter

Type

Example

Required

Description and note

Parameter

Type

Example

Required

Description and note

regionId

String

cn-shanghai

Yes

The ID of the region to which the instance belongs.

clusterId

String

pc-2ze82jv51re2990g5

Yes

The ID of the PolarDB cluster.

database

String

mysql_database

Yes

The name of the database.

dbType

String

mysql

Yes

The type of the PolarDB compute engine. Valid values:

  • mysql

  • postgresql

username

String

xxxxx

Yes

The username.

password

String

xxxxx

Yes

The password.

securityProtocol

String

authTypeNone

No

The authentication type. Valid values:

  • authTypeNone: No authentication type is specified.

  • authTypeSsl: SSL authentication is enabled.

truststoreFile

String

1

No

The ID of the truststore file.

truststorePassword

String

apasara

No

The password of the truststore file.

keystoreFile

String

2

No

The ID of the Keystore file.

keystorePassword

String

apasara

No

The password of the Keystore file.

readOnlyDBInstance

String

pc-2ze82jv51re2990g5.rwlb.rds.aliyuncs.com:3306

No

The address of the secondary database.

envType

String

Dev

Yes

The information about the data source environment. Valid values:

  • Dev: The development environment.

  • Prod: The production environment.

Instance mode of another Alibaba Cloud account

Parameter

Type

Example

Required

Description and note

Parameter

Type

Example

Required

Description and note

regionId

String

cn-shanghai

Yes

The ID of the region to which the instance belongs.

clusterId

String

pc-2ze82jv51re2990g5

Yes

The ID of the PolarDB cluster.

database

String

mysql_database

Yes

The name of the database.

dbType

String

mysql

Yes

The type of the PolarDB compute engine. Valid values:

  • mysql

  • postgresql

username

String

xxxxx

Yes

The username.

password

String

xxxxx

Yes

The password.

crossAccountOwnerId

String

1

Yes

The ID of another Alibaba Cloud account.

crossAccountRoleName

String

mysql-role

Yes

The name of the RAM role assumed by another Alibaba Cloud account.

securityProtocol

String

authTypeNone

No

The authentication type. Valid values:

  • authTypeNone: No authentication type is specified.

  • authTypeSsl: SSL authentication is enabled.

truststoreFile

String

1

No

The ID of the truststore file.

truststorePassword

String

apasara

No

The password of the truststore file.

keystoreFile

String

2

No

The ID of the Keystore file.

keystorePassword

String

apasara

No

The password of the Keystore file.

envType

String

Dev

Yes

The information about the data source environment. Valid values:

  • Dev: The development environment.

  • Prod: The production environment.

Connection string mode

Parameter

Type

Example

Required

Description and note

Parameter

Type

Example

Required

Description and note

dbType

String

mysql

Yes

The type of the PolarDB compute engine. Valid values:

  • mysql

  • postgresql

address

Array

[
  {
    "host": "127.0.0.1",
    "port": 3306
  }
]

Yes

The address, which can contain one or more pairs of host and port.

database

String

mysql_database

Yes

The name of the database.

username

String

xxxxx

Yes

The username.

password

String

xxxxx

Yes

The password.

securityProtocol

String

authTypeNone

No

The authentication type. Valid values:

  • authTypeNone: No authentication type is specified.

  • authTypeSsl: SSL authentication is enabled.

truststoreFile

String

1

No

The ID of the truststore file.

truststorePassword

String

apasara

No

The password of the truststore file.

keystoreFile

String

2

No

The ID of the Keystore file.

keystorePassword

String

apasara

No

The password of the Keystore file.

properties

JSON Object

{
    "useSSL": "false"
}

No

The properties of the driver.

envType

String

Dev

Yes

The information about the data source environment. Valid values:

  • Dev: The development environment.

  • Prod: The production environment.

Configuration example of a data source

Instance mode of the current Alibaba Cloud account

{
    "envType": "Prod",
    "dbType": "mysql",
    "clusterId": "pc-xxxxxxxxx",
    "regionId": "cn-shanghai",
    "database": "db",
    "username": "aliyun",
    "password": "xxx",
    "securityProtocol": "authTypeNone"
}

Instance mode of another Alibaba Cloud account

{
    "envType": "Prod",
    "dbType": "postgresql",
    "clusterId": "pc-xxxxxxxxx",
    "regionId": "cn-shanghai",
    "database": "db",
    "username": "aliyun",
    "password": "xxx",
    "crossAccountOwnerId": "1234567890",
    "crossAccountRoleName": "my_ram_role",
    "securityProtocol": "authTypeNone"
}

Connection string mode

{
    "envType": "Prod",
    "dbType": "mysql",
    "address": [
        {
            "host": "127.0.0.1",
            "port": 5432
        }
    ],
    "database": "db",
    "properties": {
        "connectTimeout": "2000"
    },
    "username": "aliyun",
    "password": "xxx"
}
  • On this page (1, T)
  • Property definition
  • Instance mode of the current Alibaba Cloud account
  • Instance mode of another Alibaba Cloud account
  • Connection string mode
  • Configuration example of a data source
  • Instance mode of the current Alibaba Cloud account
  • Instance mode of another Alibaba Cloud account
  • Connection string mode
Feedback