Visual Builder provides developers with the capability to create applications utilizing an external Oracle database. For organizations prioritizing data security, the preference is often to maintain their database within a private subnet, avoiding exposure on public networks. With the recent ability to provision a Visual Builder instance in a private subnet, developers can now just as easily create apps exposing data from a database in a secure, private network.
There are two common methods to accomplish this: replacing the built-in database with an external one and generating VB business objects, or utilizing VB to connect to ORDS exposing the database as RESTful services.
This blog post will guide you through the configuration process and demonstrate how to create an application in this context, offering a practical example.
Included in the latest release is the ability to create a new Visual Builder instance using a Private Subnet. This means you can connect your Private VB instance directly to your Private Autonomous Database!
Oracle always tries to make our products as secure as possible, and second we try to make working with them as easy as we can without compromising the security. The new Private Visual Builder feature accomplishes both.
In this post I'll walk through the steps to attach a Database to Visual Builder, both on a private subnet.
TLDR; This is the same process as connecting with Public resources.
–>Quick Links
- Collect the Wallet file and some details about your Database needed for the examples.
Autonomous Database Details - Configure your Private Visual Builder instance to use your Private Autonomous Database
Connect Visual Builder to the Autonomous Database - Create a Proof of Concept application that connects to your ORDS API with a Service Connection
Visual Builder Application - If you don't already have an ORDS API to connect to, you can follow these examples
Prerequisites
- You have created an Oracle ATP Database that only uses a private subnet
- You have created an Oracle Visual Builder instance using the same private subnet
- You have used one of the methods in the docs to configure access to the private VB instance. (For my examples I'm using the Load Balancer method)
Autonomous Database Details
First you'll need a couple things from the Autonomous Database details page.
- Open the Autonomous Database details page for your private DB
- Copy the OCID for your Database and save it for later
- Click the "Database Connection" button
- Click the "Download Wallet" button, fill in the details, save the file and close the connections frame
- Switch to the "Tool Configuration" tab
- Locate the "Web Access (ORDS) section, copy and save the "Private access URL" (You'll use this to test the service connection)
Connect Visual Builder to the Autonomous Database
Now you'll replace the Database include with your VB instance with your Private Autonomous Database.
- Open the Service Homepage for your VB instance
- Expand the side menu
- Open the "Settings" page
- Switch to the "Tenant Database" tab and click "Use Different Database"
- Set the "Connection Type" to "Oracle Autonomous Transaction Processing Cloud Wallet"
- Drag the wallet zip file from above, drop it into the "Upload Wallet" box and enter the password for the Zip file in "Wallet Password"
- Populate the remaining fields with your Database connection values
- Click "Next"
- Click "Finish"
- Once the connection is complete click "Reload"
Your Visual Builder instance is now using your Private Autonomous Database. You can now either create new business objects that will store data in tables in the private database, or map business objects to existing tables in the database.
If you're already familiar with Visual Builder, you can stop here and go work with your applications. If you still aren't sure it's the same as working with a public instance, you can follow the below examples to create a Proof of Concept Application.
Visual Builder Application with Private ORDS services
New VB application
- Open the Service Homepage for your VB instance
- Click the "New" button
- Enter an "Application Display Name" and click Finish
Create a Service Connection for your ORDS API
- Open the "Services" panel
- Click the "+ Service Connection" button
- Click "Define by Specification"
- Populate the details
If you already have an ORDS API in your Private Database, replace the following information with yours.
If you need one, you can follow these instructions.
Name: Gifts
URL: "<ORDS URL copied from above>vb_demo/open-api-catalog/gifts/"
Metadata Retrieval Option: "Copy full OpenAPI to the application"
Connection Type: "Dynamic, the service does not support CORS" - Click "Create Backend"
- Select "Compute missing operantionIds"
- Click "OK"
- Enter the "Backend Name"
'Gifts' - Click "Create"
Create a Web Application
- Open the "Web Apps" panel
- Click the "+ Web Application" button
- Enter a name and click "Create"
- Open the "Data" tab and expand Services / Gifts / Other Endpoints
- Drag "Get Many" and drop it into the application page
- Select Render as "Table"
- Select all of the objects under "{ } item[i]" then click "Next"
- Click "Finish"
The data from your ORDS API will be displayed in your application
Open the Cloud Shell in your Private Subnet
The following sections are only needed if you don't already have an ORDS API.
- In your OCI Console, open the "Cloud Shell"
- Expand the "Network" list and select "Ephemeral private network setup"
- Select your VCN and your Private Subnet then click "Use as active network"
Note: Steps 2 & 3 are the only difference between using a Public and Private subnet for these examples.
If you started reading this post thinking this was going to be a difficult process, this Proof of Concept should alleviate your concerns. Your new Private Visual Builder instance should function the same as a Public instance with the added security of being inside of a Private Subnet.
Create Database Objects and an ORDS API
- Copy the OCID for your new database that you saved above
- In the cloud shell enter the following commands
Replace the <text> items with your valuesexport DB_OCID=<your copied ocid> mkdir -p ~/wallets/vbdemo cd ~/wallets/vbdemo oci db autonomous-database generate-wallet --autonomous-database-id ${DB_OCID} --password Pw4ZipFile --file Wallet_VBDEMO.zip unzip Wallet_VBDEMO.zip export TNS_ADMIN=~/wallets/vbdemo - Connect to SQLcl
sql admin/<Your Admin Password>@<your TNS Name>
- Create a new schema
CREATE USER VB_DEMO IDENTIFIED BY Tester1tester; ALTER USER VB_DEMO TEMPORARY TABLESPACE temp; GRANT CONNECT, RESOURCE, CREATE SESSION, UNLIMITED TABLESPACE TO VB_DEMO; GRANT CREATE TABLE, CREATE VIEW, CREATE SEQUENCE, CREATE PROCEDURE, CREATE TYPE, CREATE SYNONYM TO VB_DEMO;
- REST enable the schema
BEGIN ORDS.ENABLE_SCHEMA( p_enabled => TRUE, p_schema => 'VB_DEMO', p_url_mapping_type => 'BASE_PATH', p_url_mapping_pattern => 'vb_demo', p_auto_rest_auth=> FALSE ); commit; END; / - Create the gifts table
CREATE TABLE VB_DEMO.GIFTS ( ID NUMBER GENERATED ALWAYS AS IDENTITY, PRODUCT VARCHAR2(20 BYTE) COLLATE "USING_NLS_COMP", COST NUMBER, SKU NUMBER, PICTURE VARCHAR2(4000 BYTE) COLLATE "USING_NLS_COMP", PRIMARY KEY (ID) ) DEFAULT COLLATION "USING_NLS_COMP";
- REST enable the table
BEGIN ORDS.ENABLE_OBJECT(p_enabled => TRUE, p_schema => 'VB_DEMO', p_object => 'GIFTS', p_object_type => 'TABLE', p_object_alias => 'gifts', p_auto_rest_auth => FALSE); commit; END; / - Insert data
SET DEFINE OFF INSERT INTO VB_DEMO.GIFTS (PRODUCT, COST, SKU, PICTURE) VALUES ('USB Drive', 40, 1234, 'https://easydrive.com.my/wp-content/uploads/2015/08/Mini-Clip-USB-Flash-Drive-V1-Red.jpg'); INSERT INTO VB_DEMO.GIFTS (PRODUCT, COST, SKU, PICTURE) VALUES ('Pen', 10, 1236, 'https://blogs.oracle.com/content/published/api/v1.1/assets/CONT81990C8032A24DB1833F3A04FFD142CE/Medium?cb=_cache_ee8b&format=jpg&channelToken=8c4b6a04814448d6bbe9b2bc6ba48c32'); INSERT INTO VB_DEMO.GIFTS (PRODUCT, COST, SKU, PICTURE) VALUES ('Notebook', 20, 1238, 'https://blogs.oracle.com/content/published/api/v1.1/assets/CONT50B4BD64848547B8A3AC5D3C3D147B23/Medium?cb=_cache_ee8b&format=jpg&channelToken=8c4b6a04814448d6bbe9b2bc6ba48c32'); INSERT INTO VB_DEMO.GIFTS (PRODUCT, COST, SKU, PICTURE) VALUES ('USB Charger', 30, 1240, 'https://cdna.4imprint.com/prod/300/458202.jpg'); INSERT INTO VB_DEMO.GIFTS (PRODUCT, COST, SKU, PICTURE) VALUES ('USB Drive', 40, 1242, 'https://easydrive.com.my/wp-content/uploads/2015/08/Mini-Clip-USB-Flash-Drive-V1-Red.jpg'); INSERT INTO VB_DEMO.GIFTS (PRODUCT, COST, SKU, PICTURE) VALUES ('Pen', 10, 1244, 'https://blogs.oracle.com/content/published/api/v1.1/assets/CONT81990C8032A24DB1833F3A04FFD142CE/Medium?cb=_cache_ee8b&format=jpg&channelToken=8c4b6a04814448d6bbe9b2bc6ba48c32'); INSERT INTO VB_DEMO.GIFTS (PRODUCT, COST, SKU, PICTURE) VALUES ('Notebook', 20, 1246, 'https://blogs.oracle.com/content/published/api/v1.1/assets/CONT50B4BD64848547B8A3AC5D3C3D147B23/Medium?cb=_cache_ee8b&format=jpg&channelToken=8c4b6a04814448d6bbe9b2bc6ba48c32'); INSERT INTO VB_DEMO.GIFTS (PRODUCT, COST, SKU, PICTURE) VALUES ('USB Charger', 30, 1248, 'https://cdna.4imprint.com/prod/300/458202.jpg'); INSERT INTO VB_DEMO.GIFTS (PRODUCT, COST, SKU, PICTURE) VALUES ('USB Drive', 40, 1250, 'https://easydrive.com.my/wp-content/uploads/2015/08/Mini-Clip-USB-Flash-Drive-V1-Red.jpg'); INSERT INTO VB_DEMO.GIFTS (PRODUCT, COST, SKU, PICTURE) VALUES ('Pen', 10, 1252, 'https://blogs.oracle.com/content/published/api/v1.1/assets/CONT81990C8032A24DB1833F3A04FFD142CE/Medium?cb=_cache_ee8b&format=jpg&channelToken=8c4b6a04814448d6bbe9b2bc6ba48c32'); INSERT INTO VB_DEMO.GIFTS (PRODUCT, COST, SKU, PICTURE) VALUES ('Notebook', 20, 1254, 'https://blogs.oracle.com/content/published/api/v1.1/assets/CONT50B4BD64848547B8A3AC5D3C3D147B23/Medium?cb=_cache_ee8b&format=jpg&channelToken=8c4b6a04814448d6bbe9b2bc6ba48c32'); INSERT INTO VB_DEMO.GIFTS (PRODUCT, COST, SKU, PICTURE) VALUES ('USB Charger', 30, 1256, 'https://cdna.4imprint.com/prod/300/458202.jpg'); INSERT INTO VB_DEMO.GIFTS (PRODUCT, COST, SKU, PICTURE) VALUES ('Mug', 25, 3322, 'https://i.ebayimg.com/images/g/M48AAOSwgyxWW5M9/s-l640.jpg'); commit; - Exit SQLcl
exit
