|
| 1 | +// Copyright (c) 2023, Oracle and/or its affiliates. |
| 2 | +// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ |
| 3 | + |
| 4 | +[#autonomous-database] |
| 5 | +== Autonomous Database |
| 6 | + |
| 7 | +https://docs.oracle.com/en/cloud/paas/atp-cloud/index.html[Autonomous Database] is a data management service built |
| 8 | +on self-driving Oracle Autonomous Database technology to deliver automated patching, upgrades, and tuning, including |
| 9 | +performing all routine database maintenance tasks while the system is running, without human intervention. |
| 10 | + |
| 11 | +Maven coordinates, using <<getting-started.adoc#bill-of-materials, Spring Cloud OCI BOM>>: |
| 12 | + |
| 13 | +[source,xml] |
| 14 | +---- |
| 15 | +<dependency> |
| 16 | + <groupId>com.oracle.cloud.spring</groupId> |
| 17 | + <artifactId>spring-cloud-oci-starter-adb</artifactId> |
| 18 | +</dependency> |
| 19 | +---- |
| 20 | + |
| 21 | +Gradle coordinates: |
| 22 | + |
| 23 | +[source,subs="normal"] |
| 24 | +---- |
| 25 | +dependencies { |
| 26 | + implementation("com.oracle.cloud.spring:spring-cloud-oci-starter-adb") |
| 27 | +} |
| 28 | +---- |
| 29 | + |
| 30 | +=== Using Autonomous Database |
| 31 | + |
| 32 | +The starter automatically configures and registers an `AutnomousDb` bean in the Spring application context. |
| 33 | +The `AutnomousDb` bean (link[Javadoc]) can be used to create an Autonomous Database, get details of an Autonomous Database, |
| 34 | +delete an Autonomous Database and generate a wallet for an Autonomous Database. |
| 35 | + |
| 36 | +[source,java] |
| 37 | +---- |
| 38 | +@Autowired |
| 39 | +private Queue queue; |
| 40 | +
|
| 41 | +public void createQueue() { |
| 42 | +
|
| 43 | + String queueId = queue.createQueue("my-queue", <<compartmentId>>, <<deadLetterQueueDeliveryCount>>, <<retentionInSeconds>>); |
| 44 | +} |
| 45 | +@Autowired |
| 46 | +AutonomousDb autonomousDatabase; |
| 47 | +
|
| 48 | +public void createAutonomousDatabase() { |
| 49 | + autonomousDatabase.createAutonomousDatabase( |
| 50 | + databaseName, compartmentId, adminPassword, dataStorageSizeInGBs, computeCount); |
| 51 | +} |
| 52 | +
|
| 53 | +public void getAutonomousDatabase() { |
| 54 | + AutonomousDbDetails response = autonomousDatabase.getAutonomousDatabase(databaseId); |
| 55 | +} |
| 56 | +
|
| 57 | +public void getAutonomousDatabaseWallet() { |
| 58 | + GenerateAutonomousDatabaseWalletResponse response = autonomousDatabase.generateAutonomousDatabaseWallet(databaseId, password); |
| 59 | + InputStream is = response.getInputStream(); |
| 60 | + int ContentLength = response.getContentLength(); |
| 61 | + // read the InputStream to get the wallet |
| 62 | +} |
| 63 | +
|
| 64 | +public void deleteAutonomousDatabase() { |
| 65 | + DeleteAutonomousDatabaseResponse response = autonomousDatabase.deleteAutonomousDatabase(databaseId); |
| 66 | +} |
| 67 | +---- |
| 68 | + |
| 69 | + |
| 70 | +=== Configuration |
| 71 | + |
| 72 | +The Spring Boot Starter for Oracle Autonomous Database provides the following configuration options: |
| 73 | + |
| 74 | +|=== |
| 75 | +^| Name ^| Description ^| Required ^| Default value |
| 76 | +| `spring.cloud.oci.adb.enabled` | Enables the OCI Autonomous Database APIs. | No | `true` |
| 77 | +|=== |
| 78 | + |
| 79 | + |
| 80 | +=== Sample |
| 81 | + |
| 82 | +A sample application provided https://github.com/oracle/spring-cloud-oci/tree/main/spring-cloud-oci-samples/spring-cloud-oci-adb-sample[here] contains the examples to demonstrates the usage of OCI Spring Cloud Autonomous Database module. |
0 commit comments