Java – Connect to Azure Cosmos DB (SQL API) No.11

In this blog, how to connect to Cosmos DB SQL API by Java is shown. ▼1. Connect to Azure Cosmos DB Azure Cosmos DB is NoSQL Database. it is not Relational Database. we don’t need to set schema and table beforehand. we need to set partition key for a collection of a container to distribute data into the partitions. ▼2. Prerequisites 2-1. Prepare for a trial free Azure Cosmos DB Account, not necessary for a subscription https://cosmos.azure.com/try/ 2-2. Enable Maven auto-import in IntelliJ IDEA Enable auto-import on IntelliJ IDEA No.13 2-3. Update Pom.xml Please change the latest version each libraries. (a part of pom.xml) <dependencies> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-simple</artifactId> <version>1.7.30</version> </dependency> … Continue reading “Java – Connect to Azure Cosmos DB (SQL API) No.11”

Java -Retrieve data on Azure Cosmos DB (SQL API) No.15

In this blog, how to retrieve data on Azure Cosmos DB is shown. ▼1. Retrieve Data on Azure Cosmos DB (SQL API)  Using steam() and iterableByPage() in CosmosPagedIterable<T> class of com.azure.cosmos.util library, We can retrieve data on Cosmos DB. ▼2. Prerequisites 2-1. Free trial Cosmos DB account is available without subscription. https://azure.microsoft.com/ja-jp/try/cosmosdb/ 2-2. Enabling Maven auto-import in IntelliJ IDEA on Ubuntu Enable auto-import on IntelliJ IDEA No.13 2-3. Creating sample data Java – Create Database on Azure Cosmos DB (SQL API) Database No.14 ▼3. Java code to retrieve data on Cosmos DB (SQL API) 3-1. Creating Java code to find item Update the following parameters according to the setting on your environment … Continue reading “Java -Retrieve data on Azure Cosmos DB (SQL API) No.15”

Java – Create Database on Azure Cosmos DB (SQL API) No.14

In this blog, how to create database on Azure Cosmos DB (SQL API) using Java is shown. ▼1. Some kinds of Azure Cosmos DB Azure Cosmos DB is NoSQL Database. there are some kinds of API below. Choose an API in Azure Cosmos DB ▼2. Prerequisites 2-1. Free trial Cosmos DB account is available without subscription. https://azure.microsoft.com/ja-jp/try/cosmosdb/ 2-2. Enable Maven auto-import in IntelliJ IDEA on Ubuntu Enable auto-import on IntelliJ IDEA No.13 ▼3. Creating Database , Container and Data on Cosmos DB (SQL API) の Database, Container by Java 3-1. Java Coding These parameters should be changed according to your setting on your environment. Family class is used to insert … Continue reading “Java – Create Database on Azure Cosmos DB (SQL API) No.14”

Java – Delete Data on Azure Cosmos DB (SQL API) No.18

How to delete data on Azure Cosmos DB SQL API is written in this blog. ▼1. Delete data on Azure Cosmos DB (SQL API) Multiple Items in container on Azure Cosmos DB (SQL API) will be deleted using CosmosContainer.<T>deleteItem of Java. ▼2. Prerequisites 2-1. Free trial Cosmos DB account is available without subscription. https://azure.microsoft.com/ja-jp/try/cosmosdb/ 2-2. Enable Maven auto-import in IntelliJ IDEA on Ubuntu Enable auto-import on IntelliJ IDEA No.13 2-3.  Using Azure Cosmos DB Java SDK v4 4.8.0 Adding dependency of a Cosmos DB library in pom.xml Azure Cosmos DB Java SDK v4 for Core (SQL) API: release notes and resources 2-4. Creating Database and container Java – Create Database … Continue reading “Java – Delete Data on Azure Cosmos DB (SQL API) No.18”

Java – Save the results of select on Azure Cosmos DB SQL API into Azure Blob Storage No.74

I will show Java code that save results of select query as a JSON file into Azure Blob Storage. In the previous blog, I shared how to save results of select query on Cosmos DB as a JSON file into the local path. in this blog, I will save results into Azure Blob Storage. ▼1. Migration data from Cosmos DB to Azure Blob Storage We can migrate data from Cosmos DB to Azure Blob Storage using dt.exe or dtui.exe easily. this document is helpful for these migration. but I will share you how to migrate data on Azure Cosmos DB into Azure Blob Storage using Java. Ref:  Tutorial: Use Data … Continue reading “Java – Save the results of select on Azure Cosmos DB SQL API into Azure Blob Storage No.74”

Java – Azure Cosmos DB (SQL) : Save results of select into a JSON file No.73

I will show Java code that save results of select query into a JSON file. In the previous blog, I shared how to save results of select query on Cosmos DB into a text file. in this blog, I will save results into a JSON file. ▼1. What is a JSON format? The following data types are supported in JSON format. This is an example of a JSON file. Ref: JSON – Wikipedia { “Records”: [ { “id”: 1, “lastName”: “Travase”, “isRegistered”: false }, { “id”: 2, “lastName”: “Ken”, “isRegistered”: true }, { “id”: 3, “lastName”: “Sai”, “isRegistered”: false } ] } ▼2. Prerequisites 2-1. Free trial Azure Cosmos DB Account … Continue reading “Java – Azure Cosmos DB (SQL) : Save results of select into a JSON file No.73”

Java – Azure Cosmos DB (SQL) : Save results of select into a text file No.72

I will show Java code that save results of select query into a text file. ▼1. Prerequisites 1-1. Free Azure Cosmos DB Account You can use trial free Cosmos DB Accounthttps://azure.microsoft.com/ja-jp/try/cosmosdb/ 1-2. Installing Visual Studio Code https://code.visualstudio.com/docs/setup/linux 1-3. Installing Maven Ref: Apache Kafka Word Count 実装 – Java No.44line of 2-3 1-4. Creating sample data Ref: Java Azure Cosmos DB (SQL API) Database の作成方法 No.14 ▼2. Java code for saving results of select query on Cosmos DB into a text file 2-1. Making a directory Making a directory to create an application. 2-2. Deploying Apache Maven project (a part of stdout) xxxx [INFO] Scanning for projects… [INFO] [INFO] ——————< org.apache.maven:standalone-pom … Continue reading “Java – Azure Cosmos DB (SQL) : Save results of select into a text file No.72”