Skip to content

Commit 8dc376c

Browse files
Merge branch 'main' into update-ords-sql-forms-modern-I
2 parents 96f1e21 + 489188d commit 8dc376c

5 files changed

Lines changed: 161 additions & 1 deletion

File tree

ai/gen-ai-agents/custom-rag-agent/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ jupyter_client==8.6.3
8080
jupyter_core==5.7.2
8181
jupyter_server==2.15.0
8282
jupyter_server_terminals==0.5.3
83-
jupyterlab==4.3.5
83+
jupyterlab==4.4.8
8484
jupyterlab_pygments==0.3.0
8585
jupyterlab_server==2.27.3
8686
jupyterlab_widgets==3.0.13
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
This repo contains some simple Java console application, which uses MongoDB Reactive Driver to perform some operations against
2+
Oracle Database with Oracle API for MongoDB enabled
3+
4+
# License
5+
6+
Copyright (c) 2025 Oracle and/or its affiliates.
7+
8+
Licensed under the Universal Permissive License (UPL), Version 1.0.
9+
10+
See [LICENSE](https://github.com/oracle-devrel/technology-engineering/blob/main/LICENSE) for more details.
11+
12+
# Requirements
13+
1. Java JDK 21
14+
2. Oracle Database 23ai (any release) with Oracle API MongoDB configured and enabled
15+
3. ORADEV schema in the database (as it is used by the code)
16+
4. EMPLOYEES table installed in ORADEV schema. It can be taken from HR sample schema
17+
5. Sample collections in ORADEV schema
18+
EMP_JSON_VIEW, which can be created as a collection view using the following SQL statement :
19+
create json collection view EMP_JSON_VIEW
20+
as
21+
select JSON{*}
22+
from EMPLOYEES;
23+
6. COLORS json collection, which can be created as JSON collection table, using the following SQL statement :
24+
create json collection table COLORS;
25+
26+
7. It is required also to set DB_URI environment variable to connect string pointing to Oracle API MongoDB instance, which will be used.
27+
28+
# Notes
29+
1. Please, note, that this application uses Reactive MongoDB driver, which allows for executing database operations in async mode.
30+
2. Also - to perform database operation in reactive mode (which is, in fact, a client-side emulation of asynchronous mode).
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
<?xml version="1.0" encoding="UTF-8"?>
3+
<project xmlns="http://maven.apache.org/POM/4.0.0"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
6+
<modelVersion>4.0.0</modelVersion>
7+
8+
<groupId>com.oracle</groupId>
9+
<artifactId>MongoDBAsyncDriverDemo</artifactId>
10+
<version>1.0-SNAPSHOT</version>
11+
12+
<properties>
13+
<maven.compiler.source>21</maven.compiler.source>
14+
<maven.compiler.target>21</maven.compiler.target>
15+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
16+
</properties>
17+
<dependencies>
18+
<!-- https://mvnrepository.com/artifact/org.mongodb/mongodb-driver-reactivestreams -->
19+
<dependency>
20+
<groupId>org.mongodb</groupId>
21+
<artifactId>mongodb-driver-reactivestreams</artifactId>
22+
<version>5.6.0</version>
23+
</dependency>
24+
<!-- https://mvnrepository.com/artifact/org.apache.storm/flux-core -->
25+
<dependency>
26+
<groupId>org.apache.storm</groupId>
27+
<artifactId>flux-core</artifactId>
28+
<version>2.8.2</version>
29+
</dependency>
30+
<!-- https://mvnrepository.com/artifact/io.projectreactor/reactor-core -->
31+
<dependency>
32+
<groupId>io.projectreactor</groupId>
33+
<artifactId>reactor-core</artifactId>
34+
<version>3.8.0-M7</version>
35+
</dependency>
36+
</dependencies>
37+
</project>
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
2+
package com.oracle;
3+
4+
import com.mongodb.ConnectionString;
5+
import com.mongodb.MongoClientSettings;
6+
import com.mongodb.ServerApi;
7+
import com.mongodb.ServerApiVersion;
8+
import com.mongodb.client.result.InsertManyResult;
9+
import com.mongodb.reactivestreams.client.MongoCollection;
10+
import org.bson.Document;
11+
import com.mongodb.reactivestreams.client.MongoClient;
12+
import com.mongodb.reactivestreams.client.MongoClients;
13+
import com.mongodb.reactivestreams.client.MongoDatabase;
14+
import org.reactivestreams.Publisher;
15+
import reactor.core.publisher.Mono;
16+
import java.util.Arrays;
17+
import java.util.List;
18+
import static com.mongodb.client.model.Filters.eq;
19+
//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
20+
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
21+
public class Main {
22+
23+
private static MongoDatabase database;
24+
private static boolean latch = true;
25+
26+
27+
public static void readSampleData() {
28+
// due to asynchronous nature of the code there is need to use
29+
// try-with-resource blocks, they guarantee that all the resources are freed
30+
// after the execution
31+
//using reactor package to perform operations in the reactive mode
32+
String uri = System.getenv("DB_URI");
33+
ServerApi serverApi = ServerApi.builder()
34+
.version(ServerApiVersion.V1)
35+
.build();
36+
MongoClientSettings settings = MongoClientSettings.builder()
37+
.applyConnectionString(new ConnectionString(uri))
38+
.serverApi(serverApi)
39+
.build();
40+
try (MongoClient mongoClient = MongoClients.create(settings)) {
41+
MongoDatabase database = mongoClient.getDatabase("oradev");
42+
MongoCollection<Document> employees = database.getCollection("EMP_JSON_VIEW");
43+
Mono.from(employees.find(eq("LAST_NAME", "King")))
44+
.doOnSuccess(i -> System.out.println(i))
45+
.doOnError(err -> System.out.println("Error: " + err.getMessage()))
46+
.block();
47+
}
48+
}
49+
50+
public static void insertData() {
51+
Document doc1 = new Document("name", "Pink"),
52+
doc2 = new Document("name", "Grey"),
53+
doc3 = new Document("name","Dark-Green"),
54+
doc4 = new Document("name","Magenta"),
55+
doc5 = new Document("name","Black"),
56+
doc6 = new Document("name","White"),
57+
doc7 = new Document("name","Red"),
58+
doc8 = new Document("name","Green"),
59+
doc9 = new Document("name","Blue"),
60+
doc10 = new Document("name","Yellow");
61+
62+
List<Document> docs = Arrays.asList(doc1,doc2,doc3,doc4,doc5,doc6,doc7,doc8,doc9,doc10);
63+
64+
String uri = System.getenv("DB_URI");
65+
ServerApi serverApi = ServerApi.builder()
66+
.version(ServerApiVersion.V1)
67+
.build();
68+
MongoClientSettings settings = MongoClientSettings.builder()
69+
.applyConnectionString(new ConnectionString(uri))
70+
.serverApi(serverApi)
71+
.build();
72+
try (MongoClient mongoClient = MongoClients.create(settings)) {
73+
MongoDatabase database = mongoClient.getDatabase("oradev");
74+
MongoCollection<Document> colors = database.getCollection("colors");
75+
76+
Publisher<InsertManyResult> iPublisher = colors.insertMany(docs);
77+
Mono.from(iPublisher).block();
78+
}
79+
}
80+
81+
public static void main(String[] args) {
82+
readSampleData();
83+
System.out.println("Data read");
84+
insertData();
85+
System.out.println("Data inserted");
86+
}
87+
}

data-platform/autonomous-database/autonomous-serverless/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ Reviewed: 23.10.2024
6565

6666
- [The Oracle Data Marketplace](https://medium.com/@mmy0utu8e/the-oracle-data-marketplace-ddbf4ac92b87)
6767
- How to share/consume data using Data Marketplace on the Autonomous Database
68+
69+
- [Using the new graphical interface for Database Replay to test new patches on Autonomous Database](https://medium.com/@adrian.capitanu/using-database-replay-to-test-new-patches-on-autonomous-database-6701ed9def6e)
70+
- How to automate testing of new patches before implementing them in a Production Autonomous Database
71+
72+
- [Prevent Performance Drops: Proactively Managing Capacity with Oracle’s Autonomous Database ResourceUtilizationWarning](https://medium.com/@mmy0utu8e/prevent-performance-drops-611677160f35)
73+
- Proactively Manage Capacity
6874

6975
## Tip of the Day
7076

0 commit comments

Comments
 (0)