Scenario: Connecting IoT Data to APEX

To use Oracle Application Express (APEX) with your Internet of Things (IoT) data follow these steps to configure access and connect your data.

This diagram describes the flow to access your IoT data in APEX.

Configuring Access to your IoT Data

You can use the CLI or the API to configure the IoT domain's access to APEX and to change the password to your IoT APEX.

Using the CLI

Use the oci iot domain configure-apex-data-access to configure access to APEX for the IoT domain. Replace the <iot-domain-OCID> with the OCID for your IoT domain and replace the <your-initial-apex-password> with the initial APEX password for your IoT environment:
oci iot domain configure-apex-data-access --db-workspace-admin-initial-password "<your-initial-apex-password>" --iot-domain-id <iot-domain-OCID>
Note

The initial APEX password must be at least 12 characters.

Using the API

Use the operation ConfigureIotDomainDataAccess to configure access to APEX for the IoT domain:
POST /20250531/iotDomains/{iotDomainId}/actions/configureDataAccess
{
    "type": "APEX",
    "dbWorkspaceAdminInitialPassword": "<your-initial-apex-password>"
}

Log in to APEX

  1. Go to the APEX Console at the following URL:
    https://<data-host-domain-group-short-id>.data.iot.<region>.oci.oraclecloud.com/ords/apex
  2. Log in to the IoT domain's Workspace using the following as the workspace name and database user name using only capital letters for the <domain-short-id-from-device-host> and notice two underscores: __WKSP:
    <domain-short-id-from-device-host>__WKSP 
  3. Go to SQL Workshop and select SQL Commands to query the IoT data.
    Initially, there's 2 database schemas for the IoT domain, both use the <domain-short-id-from-device-host>, which is the host name of the IoT device:
    • <domain-short-id-from-device-host>__IOT: Schema with read only access to your digital twin definitions and telemetry.
    • <domain-short-id-from-device-host>__WKSP: Schema with read and write access.
    Note

    Notice the schema names contain two underscores: __IOT and __WKSP
  4. Query IoT data by entering and running an SQL command. Confirm you selected the correct schema for the database table you are querying, for example:
    1. Select the <domain-short-id-from-device-host>__IOT schema.
    2. Run the following command, replace the type with the data you want to view:
    • RAW_DATA
    • HISTORIZED_DATA
    • REJECTED_DATA
    • RAW_COMMAND_DATA
    This example shows how to query raw data:
    select * from RAW_DATA
  5. When the administrator account is created, a user is created in two different places, the Oracle database and the APEX application. These are different users with the same user name and password. You can change the passwords.
    1. To change the database user's password, use this SQL ALTER USER statement and the required REPLACE clause:
      ALTER USER <workspace-administrator-user-name> IDENTIFIED BY "<new-password>" REPLACE "<old-password>";
    2. To change your APEX user's password:
      • As an APEX Administrator, you can change the password. After logging into APEX as the administrator, select the Set APEX Account Password option.
      • As an APEX user, when you log in to the APEX application, you will be prompted to change your APEX password.
  6. Now, you can see your IoT data in APEX and create new user accounts in APEX administration services.
  7. To view a larger screenshot, right click and open the image in a new browser.

    View your IoT digital twin schema in APEX.