Azure Cosmos DB libraries for Java
Overview
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.
Client library
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>
Example
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();
Samples
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
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기