Docs Menu
Docs Home
/ /
/ / /

接続文字列の作成

MongoDB配置に接続するには、 接続string とも呼ばれる 接続 URIMongoDB を提供します。これは、 配置に接続する方法と接続中の動作をドライバーに指示します。

接続stringには、配置のホスト名またはIPアドレスとポート、認証メカニズム、ユーザー認証情報(該当する場合)、および接続オプションが含まれます。

Atlas でホストされていないインスタンスまたは配置に接続するには、 接続ターゲットの選択 のガイドを参照してください。

1

To retrieve your connection string for the deployment that you created in the previous step, log into your Atlas account and navigate to the Clusters page under the Database section. Click the Connect button for your new deployment.

Atlas UI のクラスター セクションの接続ボタン

データベースユーザーをまだ設定していない場合、 MongoDB は新しいユーザーを作成して設定するように要求します。

Click the Drivers button under Connect to your application and select "Java" from the Driver selection menu and the version that best matches the version you installed from the Version selection menu.

接続文字列のみを表示するには、View full code sample オプションが選択されていないことを確認します。

2

次のスクリーンショットに示すように、接続stringの右側にあるコピーアイコンをクリックして、クリップボードにコピーします。

UI の接続 コピーstring ボタンAtlas
3

Paste this connection string into a file in your preferred text editor and replace the <db_password> placeholder with your database user's password. The connection string is already populated with your database user's username.

このファイルを安全な場所に保存して、次の手順で使用します。

これらの手順を完了すると、データベースのユーザー名とパスワードを含む接続stringが作成されます。

注意

この手順で問題が発生した場合は、このページの右側または右下にある Rate this pageタブを使用してフィードバックを送信してください。

MongoDB Stack Overflowタグ またはMongoDB Reddit Community を使用して、一般的な質問のサポートを見つけることができます。

戻る

配置の作成