page_type: sample languages:
Sample code repo for Azure Cosmos DB Java SDK for SQL API. By cloning and running these samples, and then studying their implementations, you will have an example for sending various requests to Azure Cosmos DB from Java SDK via the SQL API.
File/folder | Description |
---|---|
src |
Java sample source code. Many samples have 'sync' and 'async' variants |
.gitignore |
Define what to ignore at commit time. |
CHANGELOG.md |
List of changes to the sample. |
CONTRIBUTING.md |
Guidelines for contributing to the sample. |
README.md |
This README file. |
LICENSE |
The license for the sample. |
pom.xml |
Maven Project Object Model File |
Clone the sample to your PC. Using your Java IDE, open pom.xml as a Maven project.
These environment variables must be set
ACCOUNT_HOST=your account hostname;ACCOUNT_KEY=your account master key
in order to give the samples read/write access to your account.
To run a sample, specify its Main Class
com.azure.cosmos.examples.sample.synchronicity.MainClass
where sample.synchronicity.MainClass can be
Build and execute from command line without an IDE: From top-level directory of repo:
mvn clean package
mvn exec:java -Dexec.mainClass="com.azure.cosmos.examples.sample.synchronicity.MainClass" -DACCOUNT_HOST=your account hostname -DACCOUNT_KEY=your account master key
where sample.synchronicity.MainClass, your account hostname, and your account master key are to be filled in as above. This will rebuild and run the selected sample.
These samples cover a range of Azure Cosmos DB usage topics from more to less basic:
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.