Giter Site home page Giter Site logo

joycemazumder / azure-cosmos-java-sql-api-samples Goto Github PK

View Code? Open in Web Editor NEW

This project forked from azure-samples/azure-cosmos-java-sql-api-samples

0.0 0.0 0.0 613 KB

Sample code for Azure Cosmos DB Java SDK for SQL API

License: MIT License

JavaScript 0.34% Java 99.66%

azure-cosmos-java-sql-api-samples's Introduction

page_type languages products description urlFragment
sample
java
java sdk
Sample code repo for Azure Cosmos DB Java SDK for SQL API

Azure Cosmos DB Java SQL API Samples

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.

Contents

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

Prerequisites

  • Maven
  • Java SE JRE 8
  • Setting up an Azure Cosmos DB account through the Azure Portal. The Create a database account section of this guide walks you through account creation.
  • The hostname and master key for your Azure Cosmos DB account

Setup

Clone the sample to your PC. Using your Java IDE, open pom.xml as a Maven project.

Running the sample

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

  • crudquickstart.sync.SampleCRUDQuickstart
  • crudquickstart.async.SampleCRUDQuickstartAsync
  • indexmanagement.sync.SampleIndexManagement
  • indexmanagement.async.SampleIndexManagementAsync
  • storedprocedure.sync.SampleStoredProcedure
  • storedprocedure.async.SampleStoredProcedureAsync
  • changefeed.SampleChangeFeedProcessor (Changefeed has only an async sample, no sync sample.)

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.

Key concepts

These samples cover a range of Azure Cosmos DB usage topics from more to less basic:

  • Basic management of databases, containers and items
  • Indexing, stored procedures
  • Change Feed

Contributing

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 [email protected] with any additional questions or comments.

azure-cosmos-java-sql-api-samples's People

Contributors

abhirockzz avatar anfeldma-ms avatar deepub avatar fabianmeiswinkel avatar jcocchi avatar kushagrathapar avatar microsoft-github-operations[bot] avatar microsoftopensource avatar moderakh avatar ravitella avatar snehagunda avatar srinikhilreddy avatar theovankraay avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.