Skip to content
Azure Cosmos DB's SQL API provides a JSON document database data model and the power of SQL and JavaScript over schema-less data. This tutorial shows how to get started with the SQL API and the Async Java SDK.
Branch: master
Clone or download
Latest commit fd6102a Oct 27, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Initial commit Feb 28, 2018
azure-cosmosdb-get-started minor cleanup, reformattig, pretty printing etc Oct 25, 2018
.gitignore sample get started Feb 28, 2018
CONTRIBUTING.md Initial commit Feb 28, 2018
LICENSE.md Initial commit Feb 28, 2018
README.md

README.md

services platforms author
cosmos-db
java
moderakh

Developing a Java app using Azure Cosmos DB Async Java SDK

Azure Cosmos DB is a globally distributed multi-model database. One of the supported APIs is the SQL API, which provides a JSON document model with SQL querying and JavaScript procedural logic. This sample shows you how to use the Azure Cosmos DB with the SQL API to store and access data from a Java application.

Getting Started

Prerequisites

  • Before you can run this sample, you must have the following prerequisites:

    • An active Azure account. If you don't have one, you can sign up for a free account. Alternatively, you can use the Azure Cosmos DB Emulator for this tutorial. As emulator https certificate is self signed, you need to import its certificate to java trusted cert store as explained here.

    • JDK 1.8+

    • Maven

Quickstart

  • Then, clone this repository using
git clone https://github.com/Azure-Samples/azure-cosmos-db-sql-api-async-java-getting-started.git
  • From a command prompt or shell, run the following command to compile and resolve dependencies.
cd azure-cosmos-db-sql-api-async-java-getting-started
cd azure-cosmosdb-get-started
mvn clean package
  • From a command prompt or shell, run the following command to run the application.
mvn exec:java -DACCOUNT_HOST=YOUR_COSMOS_DB_HOSTNAME -DACCOUNT_KEY=YOUR_COSMOS_DB_MASTER_KEY

About the code

The code included in this sample is intended to get you quickly started with a Java application that connects to Azure Cosmos DB with the SQL API.

More information

You can’t perform that action at this time.