

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 新增資料庫連接器
<a name="presto-adding-db-connectors"></a>

在建立叢集時，您可以使用組態分類來設定 JDBC 連接器屬性。組態分類以 `presto-connector` 開頭，例如 `presto-connector-postgresql`。可用的組態分類取決於 Amazon EMR 發行版本。如需最新發行版本的可用組態分類，請參閱 [5.36.2 組態分類](emr-5362-release.md#emr-5362-class) for Amazon EMR 5.36.2。如果您使用不同版本的 Amazon EMR，請參閱 [Amazon EMR 5.x 發行版本](emr-release-5x.md) 以了解組態分類。如需可透過各連接器設定之屬性的詳細資訊，請參閱 [https://prestodb.io/docs/current/connector.html](https://prestodb.io/docs/current/connector.html)。

**Example - 設定具有 PostgreSQL JDBC 連接器的叢集**  
若要啟動已安裝並設定了 PostgreSQL 連接器的叢集，首先請以下列內容建立指定組態分類的 JSON 檔案 (例如 `myConfig.json`) 並將其儲存於本機。  
取代適用於設定的連線屬性，如 Presto 文件中的 [PostgreSQL 連接器](https://prestodb.io/docs/current/connector/postgresql.html)主題所示。  

```
[
  {
    "Classification": "presto-connector-postgresql",
    "Properties": {
      "connection-url": "jdbc:postgresql://example.net:5432/database",
      "connection-user": "MYUSER",
      "connection-password": "MYPASS"
    },
    "Configurations": []
  }
]
```
建立叢集時，請使用以下範例所示之 `--configurations` 選項參考路徑至 JSON 檔案，其中 `myConfig.json` 位於與您執行命令時相同的目錄：  

```
aws emr create-cluster --name PrestoConnector --release-label emr-5.36.2 --instance-type m5.xlarge \
--instance-count 2 --applications Name=Hadoop Name=Hive Name=Pig Name=Presto \
--use-default-roles --ec2-attributes KeyName=myKey \
--log-uri s3://amzn-s3-demo-bucket/logs --enable-debugging \
--configurations file://myConfig.json
```