@@ -11,7 +11,7 @@ ms.reviewer: sngun
11
11
---
12
12
# Tutorial: Set up Azure Cosmos DB global distribution using the SQL API
13
13
14
- In this article, we show how to use the Azure portal to setup Azure Cosmos DB global distribution and then connect using the SQL API.
14
+ In this article, we show how to use the Azure portal to set up Azure Cosmos DB global distribution and then connect using the SQL API.
15
15
16
16
This article covers the following tasks:
17
17
@@ -105,21 +105,24 @@ client = cosmos_client.CosmosClient(ENDPOINT, {'masterKey': MASTER_KEY}, connect
105
105
106
106
```
107
107
108
- ## Java V2 SDK
108
+ ## Java V4 SDK
109
109
110
110
The following code shows how to set preferred locations by using the Java SDK:
111
111
112
- ``` java
113
- ConnectionPolicy policy = new ConnectionPolicy ();
114
- policy. setUsingMultipleWriteLocations(true );
115
- policy. setPreferredLocations(Arrays . asList(" East US" , " West US" , " Canada Central" ));
116
- AsyncDocumentClient client =
117
- new AsyncDocumentClient .Builder ()
118
- .withMasterKeyOrResourceToken(this . accountKey)
119
- .withServiceEndpoint(this . accountEndpoint)
120
- .withConnectionPolicy(policy)
121
- .build();
122
- ```
112
+ ### <a id =" java4-preferred-locations " ></a >
113
+ #### [ Async] ( #tab/api-async )
114
+
115
+ [ Java SDK V4] ( sql-api-sdk-java-v4.md ) (Maven [ com.azure::azure-cosmos] ( https://mvnrepository.com/artifact/com.azure/azure-cosmos ) ) Async API
116
+
117
+ [ !code-java[ ] ( ~/azure-cosmos-java-sql-api-samples/src/main/java/com/azure/cosmos/examples/documentationsnippets/async/SampleDocumentationSnippetsAsync.java?name=TutorialGlobalDistributionPreferredLocationAsync )]
118
+
119
+ #### [ Sync] ( #tab/api-sync )
120
+
121
+ [ Java SDK V4] ( sql-api-sdk-java-v4.md ) (Maven [ com.azure::azure-cosmos] ( https://mvnrepository.com/artifact/com.azure/azure-cosmos ) ) Sync API
122
+
123
+ [ !code-java[ ] ( ~/azure-cosmos-java-sql-api-samples/src/main/java/com/azure/cosmos/examples/documentationsnippets/sync/SampleDocumentationSnippets.java?name=TutorialGlobalDistributionPreferredLocationSync )]
124
+
125
+ ---
123
126
124
127
## REST
125
128
Once a database account has been made available in multiple regions, clients can query its availability by performing a GET request on the following URI.
0 commit comments