quarta-feira, 28 de junho de 2023

[Oracle Autonomous JSON] How to configure and using the Oracle API for MongoDB on Oracle Autonomous JSON Database - Part 1

Hello all!!!

How are you doing?

Today I'll show how you can create an Autonomous Database JSON instance on OCI Free Tier and how you can connect your MongoDB with this instance using Oracle Database API for MongoDB. 

In Part 2, I'll create new collections in the MongoDB shell and demonstrate how we can use these in the ADJ console using JSON and traditional SQL syntax.

The MongoDB is running on OCI Compute Instance :) 

But always remember:
1) This step-by-step worked for me, but it may not work for you.
2) It's a basic and limited environment. The real life will be different, for sure.
3) This post is for study and testing as well, and has no concern for performance and security best practices.

So, let's get started!!!

1) Create a VCN. I'm not show the step by step for this, but it's really easy. Google helps you!!!



2) Now, I'll create the ADJ for testing. Click on Create Autonomous Database.



















This is the most important setup that you need. For access the Oracle Database Actions Launchpad, you must have set "Secure access from allowed IPs and VCNs only" and put our VCN and our IP here. It's mandatory!!!



I'll insert my IP address and click "Add access control rule" to add my VCN, as well!

To finish, click "Create Autonomous Database" and wait!

















3) ADJ created, it's time to check access to MongoDB.

For this verification, we need the link for mongosh. Click on "Database actions". 



In the end of the page, click on "Oracle Database API for MongoDB".


Copy the MongoDB connection string URL.



Finally, access the MongoDB server and test the connection.




Oh my god! Error!!!! Why????

The error "Client network socket disconnected before secure TLS connection was established" is easy to solve.

We also need to put the Compute Instance Public and Private IP where we run the MongoDB on "Access control list".








And now, I have succeeded!!!



In the next post, I going to create some collections and load documents into MongoDB console, and I'll work with those tables in the ADJ console using the "Traditional Select Syntax".

It's going to be cool! :) 

I hope this post helps you!

Regards
Mario

Postagem em destaque

[ORACLE] Batch change EDITIONABLE property.

Hello everyone. Hope you're doing well! Today, I have a simple case.   A test database had many database objects with the EDITIONABLE pr...