Use JSON Relational Duality with Oracle Database API for Mongo DB

April 7, 2023 | 4 minute read
Hermann Baer
Senior Director Product Management
Text Size 100%:

I am not the first one telling you the exciting news about Oracle Database 23ai - generally available as of May 2nd, 2024 - and all the innovative new features that come with it for application developers, like JSON Relational Duality. I am late to the party for this one, and a great job was done here already from the Oracle side staring with the availability of the free version, e.g., Gerald Venzl here, and externally like Oracle-Base here, and we saw the reactions on social media, e.g., Lukas Eder here. I could go on, but I don't want to bore you.

 

However, one thing I missed seeing highlighted not enough yet is the integration we now have with JSON Relational Duality and our Oracle Database API for Mongo DB, short Mongo API. And it does not take you more than "2 seconds" to enable this in our VirtualBox Appliance. And that's all I wanted to share with you today.

So what do I have to do?

First, download and import our updated VirtualBox Appliance. If you are unfamiliar with this, then glance over Jeff Smith's comprehensive blog here. The site also has a link to download the appliance, so if you want to save one click right away, then click here to go to the download page.

Second, after downloading, importing, and starting the VirtualBox Appliance, you only need to do two things.

  1. Reconfigure and restart ORDS
  2. Add port forwarding for the Mongo API listener to access it from outside the VirtualBox

Reconfigure and restart ORDS

The reconfiguration of ORDS is a straightforward single command to change one property in ORDS to enable the Mongo API listener. Do these commands as the oracle user in the Virtualbox:

Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
/bin/bash /home/oracle/ords/bin/ords --config /home/oracle/ords_config config set standalone.http.port 8080
/bin/bash /home/oracle/ords/bin/ords --config /home/oracle/ords_config config set mongo.enabled true
/bin/bash /home/oracle/ords/bin/ords --config /home/oracle/ords_config config set security.verifySSL false

This is an update coming from the user community forum. The initial setup of ORDS in the VB was that enabling the MongoDB API disabled listening on the standard http port. There is no conflict between running ORDS as http server *and* running the MongoDB API. Thanks to the community, this is what it's about!

command line output when setting the configuration parameters

 

ORDS starts automatically in the VirtualBox, so if you want to take advantage of the newly enabled Mongo API, you need to restart ORDS. To restart the ORDS, one way is the following command.

Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
nohup /bin/bash /home/oracle/ords/bin/ords --config /home/oracle/ords_config serve --apex-images /home/oracle/apex_images

If you do it in the foreground or check nohup.out, you should see the following entry in the ORDS startup sequence

Start ORDS with Mongo API enabled.

 

Add port forwarding for Mongo API to the VirtualBox.

Port forwarding for Mongo API


Voilä, that was it. You are ready to use JSON Duality Views with any Mongo tool or API, either in the VirtualBox Appliance, or on the host system to use your desktop tools and development environment.

You can test whether everything worked fine right away, using the HR user as follows. This user has all the privileges set up. Assuming you have Mongo Shell installed, the following commands will connect you to HR using the Mongo API

Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
export URI='mongodb://hr:oracle@localhost:27017/hr?authMechanism=PLAIN&authSource=$external&ssl=true&retryWrites=false&loadBalanced=true'
mongosh --tlsAllowInvalidCertificates $URI

You have access to your data both relationally and in document-style:

Access the same data with SQL and with document-style

 

What's next?

There's more to come in the future, which you'll have to wait for a little bit longer. But that's no reason for you not to get started today.

Here are a couple of pointers for you to get started:

Now it's up to you to get rolling. Enjoy the Oracle Database 23ai and experience the most powerful converged database on the market. And don't forget to report your feedback, questions, bugs, enhancement requests, etc on the Forums.

 

 

 

Hermann Baer

Senior Director Product Management

Hermann is a Senior Director of Product Management in the Oracle Database organization. He and his team focus on Oracle's core functionality, such as Oracle Partitioning, the Oracle Optimizer, and analytical SQL. His team also looks after semi-structured data processing, such as the relational SQL/JSON capabilities, Oracle Text, and more recently Autonomous JSON Database and the Oracle Database API for Mongo DB.

Hermann has held several positions at Oracle in Sales Consulting and Consulting, dealing with the database for quite some time

Show more

Previous Post

ADB Newsletter for April 2023

Keith Laker | 6 min read

Next Post


How to temporarily open your cross-region disaster recovery peer for read/write with Snapshot Standbys

Nilay Panchal | 5 min read
Everything you need to know about data warehousing with the world's leading cloud solution provider
Oracle Chatbot
Disconnected