Azure Cosmos DB Java SDK - Connection Strings

Learn how to connect to Azure Cosmos DB using the Java SDK.

What are Connection Strings?

Connection strings are strings that contain the connection information needed to connect to your Azure Cosmos DB account. They include the account key, database name, and container name.

Connection String Format

The general format of a Cosmos DB connection string is:

AccountEndpoint=accountendpoint;AccountKey=accountkey;Database=database;Container=container

Example

Here's an example connection string:

AccountEndpoint=https://youraccount.documents.azure.com:443/;AccountKey=youraccountkey;Database=myDatabase;Container=myContainer

Important: Replace youraccount and youraccountkey with your actual Cosmos DB account details.

Resources