Events
Power BI DataViz World Championships
Feb 14, 4 PM - Mar 31, 4 PM
With 4 chances to enter, you could win a conference package and make it to the LIVE Grand Finale in Las Vegas
Learn moreThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Store and query key-value, JSON document, graph, and columnar data in a globally distributed database with Azure Cosmos DB.
To get started with Azure Cosmos DB, see Azure Cosmos DB: Build an API app with Java and the Azure portal.
Connect to Azure Cosmos DB using the SQL API client library to work with JSON data with SQL query syntax.
Add a dependency to your Maven pom.xml
file to use the Cosmos DB client library in your project.
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-documentdb</artifactId>
<version>1.12.0</version>
</dependency>
Select matching JSON documents in Cosmos DB using SQL query syntax.
DocumentClient client = new DocumentClient("https://contoso.documents.azure.com:443",
"contosoCosmosDBKey",
new ConnectionPolicy(),
ConsistencyLevel.Session);
List<Document> results = client.queryDocuments("dbs/" + DATABASE_ID + "/colls/" + COLLECTION_ID,
"SELECT * FROM myCollection WHERE myCollection.email = 'allen [at] contoso.com'",
null)
.getQueryIterable()
.toList();
Develop a Java app using Azure Cosmos DB MongoDB API
Develop a Java app using Azure Cosmos DB Graph API
Develop a Java app using Azure Cosmos DB SQL API
Explore more sample Java code for Azure Cosmos DB you can use in your apps.
Azure SDK for Java feedback
Azure SDK for Java is an open source project. Select a link to provide feedback:
Events
Power BI DataViz World Championships
Feb 14, 4 PM - Mar 31, 4 PM
With 4 chances to enter, you could win a conference package and make it to the LIVE Grand Finale in Las Vegas
Learn more