このページの一部またはすべての情報は、S3NS の Trusted Cloud に適用されない場合があります。詳細については、
Google Cloud との違いをご確認ください。
Cloud SQL 言語コネクタの概要
このページでは、Cloud SQL 言語コネクタの概要と、インスタンスでコネクタを使用する方法について説明します。
Cloud SQL 言語コネクタは、Cloud SQL インスタンスへの接続時に暗号化と IAM 承認を行うライブラリです。Cloud SQL 言語コネクタは、ユーザーのアプリケーションに代わってプロキシ側のサーバーと承認済みの接続を確立し、その接続をアプリケーションのデータベース ドライバに渡します。ネットワーク パスが存在しない場合、ネットワーク パスは Cloud SQL インスタンスへ提供されません。
Cloud SQL 言語コネクタは、クライアント側コンポーネントを使用して、Cloud SQL インスタンス上のプロキシ サーバーに接続します。コネクタは、所有者がサーバー側プロキシに接続することを承認する一時証明書を作成します。サーバー側プロキシは、接続するために有効な TLS 証明書を要求して、Cloud SQL データベースへのアクセスを制限します。
Cloud SQL は以下の Cloud SQL 言語コネクタをサポートしています。
Cloud SQL では、Cloud SQL 言語コネクタを使用して Cloud SQL インスタンスに接続することをおすすめします。データベース クライアントまたは Cloud SQL Auth Proxy を使用して Cloud SQL インスタンスに接続することもできます。Cloud SQL インスタンスへの接続の詳細については、接続オプションについてをご覧ください。
要件
Cloud SQL インスタンスで serverCaMode
として共有認証局(CA)を使用している場合は、クライアント側で、使用している Cloud SQL 言語コネクタが次のバージョン要件を満たしていることを確認します。
Cloud SQL インスタンスで serverCaMode
として顧客管理の CA を使用している場合は、クライアント側で、使用している Cloud SQL 言語コネクタが次のバージョン要件を満たしていることを確認します。
インスタンスが顧客管理の CA をサーバー CA モードとして使用する場合は、カスタム DNS 名を使用してインスタンスを構成できます。カスタム DNS 名は、サーバー証明書のカスタム サブジェクト代替名(SAN)フィールドに指定します。
インスタンスのカスタム DNS 名を設定したら、DNS 名を使用して Cloud SQL 言語コネクタからインスタンスに接続できます。
Cloud SQL 言語コネクタのメリット
Cloud SQL 言語コネクタには、Cloud SQL インスタンスとの接続で次の利点があります。
- IAM 認可: Identity and Access Management(IAM)権限を使用して、Cloud SQL インスタンスに接続できるユーザーや対象を制御します。
- 簡素化: SSL 証明書の管理、ファイアウォール ルールの構成、承認済みネットワークの有効化が不要になります。
制限事項
コンテキストアウェア アクセスと IAM データベース認証を使用している場合、Cloud SQL 言語コネクタは使用できません。インスタンスにログインしようとすると、IAM 認証が失敗します。
Cloud SQL 言語コネクタの使用を適用する
コネクタの適用を使用すると、Cloud SQL インスタンスへの接続に、Cloud SQL Auth Proxy または Cloud SQL 言語コネクタのみを使用するように強制できます。コネクタの適用を使用すると、Cloud SQL によりデータベースへの直接接続が拒否されます。
Private Service Connect が有効になっているインスタンスを使用している場合は、制限があります。インスタンスでコネクタの適用が有効になっている場合、そのインスタンスにリードレプリカを作成することはできません。同様に、インスタンスにリードレプリカがある場合、そのインスタンスでコネクタの適用を有効にすることはできません。
Cloud SQL Auth Proxy または Cloud SQL 言語コネクタのみを使用してインスタンスに接続するように強制する方法については、Cloud SQL 言語コネクタを使用して接続するをご覧ください。
次のステップ
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-09-04 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-09-04 UTC。"],[],[],null,["# Cloud SQL Language Connectors overview\n\n\u003cbr /\u003e\n\n[MySQL](/sql/docs/mysql/language-connectors \"View this page for the MySQL database engine\") \\| PostgreSQL \\| [SQL Server](/sql/docs/sqlserver/language-connectors \"View this page for the SQL Server database engine\")\n\n\u003cbr /\u003e\n\nThis page summarizes the Cloud SQL Language Connectors and how to use them\nwith your instances.\n\nCloud SQL Language Connectors are libraries that provide encryption and\n[IAM](/iam) authorization when connecting to a Cloud SQL instance.\nCloud SQL Language Connectors create authorized connections to the\nproxy-side server on behalf of a user's application and pass that connection to\nthe application's database driver. They don't provide a network path to a\nCloud SQL instance if one is not already present.\n\nCloud SQL Language Connectors use a client-side component to connect to a proxy server\non the Cloud SQL instance. The connector creates a temporary certificate\nthat authorizes the holder to connect to the server-side proxy. The server-side\nproxy limits access to the Cloud SQL database by requiring a valid TLS\ncertificate in order to connect.\n\nCloud SQL supports the following Cloud SQL Language Connectors:\n\n- [Cloud SQL Java connector](/sql/docs/postgres/connect-connectors#java)\n- [Cloud SQL Python connector](/sql/docs/postgres/connect-connectors#python)\n- [Cloud SQL Go connector](/sql/docs/postgres/connect-connectors#go)\n- [Cloud SQL Node.js connector](/static/sql/docs/postgres/connect-connectors#node.js)\n\nCloud SQL recommends using Cloud SQL Language Connectors to connect to your\nCloud SQL instance. You can also connect to a Cloud SQL\ninstance [using a database client](/sql/docs/postgres/connect-admin-ip) or the\n[Cloud SQL Auth Proxy](/sql/docs/postgres/sql-proxy). For more information about\nconnecting to a Cloud SQL instance, see [About connection options](/sql/docs/postgres/connect-overview).\n\nRequirements\n------------\n\nIf your Cloud SQL instance uses\n[shared certificate authority (CA)](/sql/docs/postgres/authorize-ssl#shared-regional-ca)\nas its `serverCaMode`, then on the client side,\nmake sure that the Cloud SQL Language Connectors you're using meet\nthe following version requirements:\n\n- [Cloud SQL Java connector](/sql/docs/postgres/connect-connectors#java): [v1.21.0](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/releases/tag/v1.21.0) or later\n- [Cloud SQL Go connector](/sql/docs/postgres/connect-connectors#go): [v1.12.0](https://github.com/GoogleCloudPlatform/cloud-sql-go-connector/releases/tag/v1.12.0) or later\n- [Cloud SQL Node.js connector](/static/sql/docs/postgres/connect-connectors#node.js): [v1.4.0](https://github.com/GoogleCloudPlatform/cloud-sql-nodejs-connector/releases/tag/v1.4.0) or later\n\n| **Note:** [Cloud SQL Python connector](/sql/docs/postgres/connect-connectors#python) supports instances that use the shared CA configuration, but the connector doesn't verify server identity.\n\nIf your Cloud SQL instance uses\n[customer-managed CA](/sql/docs/postgres/authorize-ssl#customer-managed-ca)\nas its `serverCaMode`, then on the client side,\nmake sure that the Cloud SQL Language Connectors you're using meet\nthe following version requirements:\n\n- [Cloud SQL Java connector](/sql/docs/postgres/connect-connectors#java): [v1.22.0](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/releases/tag/v1.22.0) or later\n- [Cloud SQL Go connector](/sql/docs/postgres/connect-connectors#go): [v1.14.0](https://github.com/GoogleCloudPlatform/cloud-sql-go-connector/releases/tag/v1.14.0) or later\n- [Cloud SQL Node.js connector](/static/sql/docs/postgres/connect-connectors#node.js): [v1.6.0](https://github.com/GoogleCloudPlatform/cloud-sql-nodejs-connector/releases/tag/v1.6.0) or later\n\nWhen an instance uses customer-managed CA as its server CA mode, you can configure\nthe instance with a [custom DNS name](/sql/docs/postgres/configure-ssl-instance#custom-dns-name).\nYou provide the custom DNS name in the\ncustom subject alternative name (SAN) field of the server certificate.\n\nAfter you set up a custom DNS name for the instance, you can connect to the\ninstance from Cloud SQL Language Connectors using the DNS name.\n\nBenefits of Cloud SQL Language Connectors\n-----------------------------------------\n\nCloud SQL Language Connectors provide the following\nbenefits with connecting to a Cloud SQL instance:\n\n- **IAM authorization**: Uses identity and access management (IAM) permissions to control who or what can connect to your Cloud SQL instances.\n- **Convenience**: Removes the requirement to manage SSL certificates, configure firewall rules, or enable authorized networks.\n\n\u003cbr /\u003e\n\nLimitations\n-----------\n\nYou can't use the Cloud SQL Language Connectors if you're using\n[context-aware access](/iap/docs/cloud-iap-context-aware-access-howto) and\nIAM database authentication. When you try to login to the instance,\nIAM authentication fails.\n\nEnforce the use of Cloud SQL Language Connectors\n------------------------------------------------\n\nBy using [connector enforcement](/sql/docs/postgres/admin-api/rest/v1/instances#ConnectorEnforcement), you can enforce using only the Cloud SQL Auth Proxy or Cloud SQL Language Connectors to connect to Cloud SQL instances. With connector enforcement, Cloud SQL rejects direct connections to the database.\n\nIf you're using a [Private Service Connect-enabled instance](/sql/docs/postgres/about-private-service-connect), then there's a limitation. If the instance has connector enforcement enabled, then you can't create read replicas for the instance. Similarly, if the instance has read replicas, then you can't enable connector enforcement for the instance.\n\nFor more information about how to enforce using only the Cloud SQL Auth Proxy or Cloud SQL Language Connectors to connect to an instance, see [Connect using Cloud SQL Language Connectors](/sql/docs/postgres/connect-connectors#enforce).\n\nWhat's next\n-----------\n\n\u003cbr /\u003e\n\n- [Connect using the Cloud SQL Java Connector](/sql/docs/postgres/connect-connectors#java).\n- [Connect using the Cloud SQL Python Connector](/sql/docs/postgres/connect-connectors#python).\n- [Connect using the Cloud SQL Go Connector](/sql/docs/postgres/connect-connectors#go).\n- [Connect using the Cloud SQL Node.js Connector](/static/sql/docs/postgres/connect-connectors#node.js).\n- Learn more about the [Cloud SQL Auth Proxy](/sql/docs/postgres/sql-proxy).\n\n\u003cbr /\u003e"]]