One of the biggest concerns of database architects and Oracle APEX developers is how to choose the best database architecture for Oracle APEX. There are some database architectures you could go for. However, they’re not all made equal, and selecting the wrong one can considerably impact the scalability and efficiency of whatever APEX app you develop.
In this article, we will see why selecting the best architecture for Oracle APEX application is one of the most important points to address as an APEX developer. Also, we will tell you about what database architecture to run Oracle APEX applications.
Why Oracle APEX App Must Run On A Well-structured
Database Architecture
There are multiple reasons why choosing the right Oracle APEX database architecture is important. We have talked about some of the reasons below.
Scalability
Every developer wants their Oracle APEX features to be scalable. It can only happen when the database objects are structured- logically and efficiently. When these objects are well-structured, there is consequently adequate partitioning of data, indexing, and normalization. All of these provide room for the application to be scaled when required.
Maintenance and Upgrades
When database objects are placed properly, it is easier to go in to do routine upgrades and maintenance tasks. Additionally, a logical structure will let you implement changes to database structures without influencing the app. Therefore, there’ll be no downtime of the application during maintenance or upgrade.
Security
Separating database objects from the APEX App Schema boosts security. This structure lets you implement more granular access controls. As a result, you are limiting unauthorized access to sensitive data.
With a well-structured database, access is only allowed through well-defined APIs or stored processes. However, with bad architecture, it’s easier for a user to gain unrestricted access to sensitive data, possibly during app maintenance. It is because everything resides together.
Collaboration
This is one of the reasons why Oracle Apex app should run on a well-structured database. Imagine you are a team of developers who are working on an application on the same Oracle Database. A well-structured database architecture allows each developer to work on different tasks without disturbing the other developers. It is because there is separation and proper modularity.
The Two Best Database Architectures
Now that we know why it is important for the Oracle APEX app to run on a well-structured database architecture, here are the two best database architectures.
Single Database Architecture
In some circumstances, the company may use one single physical database. However, other organizations use two. If you work for a company that uses a single physical database, the suggested database architecture involves creating three distinct schemas as follows:
- Data Schema
- API Schema
- UI Schema (APEX)
Data Logic Schema
In a data logic schema, all the customer data will reside. It will contain the tables, sequences, data, indexes, triggers, and packages for Data Logic. Also, views can be added so that you’ll have read access to simple tables like the List of Values.
Although the UI layer can still use objects from the data layer for read access, all the business logic will not be present in this schema but will pass through the API layer. By doing so, there will be a clear separation of concerns. The following are the advantages of data schema.
There’s a clear separation of concern.
Enhanced security
You can easily modify and scale it independently at any time.
Additionally, the principle of least privilege is boosted when the API schema gets access to data schema objects. It means that the API only has access to particular data elements and operations, which is a need to scale APEX application. As a result, it reduces the danger of unauthorized access or misuse.
API Schema
The API Schema includes Views and Packages for business logic. You can opt to add some Data Logic here that was not included in the Data Schema. Just like the Data Schema, the API Schema also has controlled views for reading tables and data from the Data Logic Schema for Data Manipulation Language (DML). The API Schema will permit these Views and Tables using Oracle Roles.
This is because roles are usually used to manage permissions at a higher level of abstraction. Hence, it becomes simpler to manage and maintain access control. Following are the advantages of API schema.
It makes it easy to modify and maintain business logic and database schema independently without impacting customer data and UI Schema.You can reuse the same business logic across multiple UIs or applications with a well-defined API schema.
This promotes consistency and reduces redundancy in code.
APIs provide a scalable way to expose business logic.
APIs enable an agile development process.
Isolating business logic in APIs makes it easier to test and debug.
UI Schema (APEX)
The UI Schema is the APEX parsing schema. It is dedicated to the app’s User Interface (UI) logic. Following are the advantages of UI schema.
- Separates UI-related concerns from business logic and data
- It lets you create numerous APEX apps in a single workspace.
- UI Schema has its Packages and Views for the UI
- Views and packages for API Schema will be permitted in the UI Schema using Oracle Roles.
- You can make changes to the user interface independently of the underlying data schema and API schema. This modularity makes it easier to modify the user interface without impacting the data or logic.
- APEX developers can work on the UI schema independently. They can design and implement the user interface without waiting for the back-end development to be completed.
- Apex app enhances security.
Two Database Architecture
In cases when there are two physical databases, the suggested architecture is to have the following:
- The Data Logic and API in one database
- The APEX app and UI in the second database
The database housing the Data Logic and API will then have three schemas:
- Data Schema
- Business logic schema
- DB Links Schema
The objective of the DB Links Schema is to make a connection between the two databases that act as an important link bridging their communication. Let’s now explain the two databases in detail:
API and Data Database
The API Schema contains the business logic. Meanwhile, the Data Logic Schema contains the customer information. These two schemas go into one database to form the Data Database and API.
The difference between this database architecture and the inappropriate one is that the latter has the business logic and customer information within the Application Schema. However, in the architecture, the Oracle Apex application schema Database is separate. Following are the advantages of API and Data Database
- The usage of database links allows for safe access control.
- It prevents authorized interactions between the backend layers and applications. Firms can scale the API and data layers separately.
- It boosts performance without impacting the APEX application itself.
Application Database
The application database works as a repository for UI-related views and logic in any Oracle APEX environment. The database links enable access from the Application Database to the API and Data database. As a result, it promotes a cohesive connection between the frontend and backend functionalities.
Also, this database contains UI-related views that allow for an efficient and organized retrieval of data for the user interface.
There are also UI-related packages that contain UI-related logic in this database. These packages give a modular structure for managing diverse user interactions. The following are the advantages of the Application Database:
- Organizations can boost their user interface without affecting the backend
- The Application Database promotes a clean separation of concerns. Therefore, the front end can work independently of the back end.
- Consolidating all UI-related logic within the Application Database makes the app development process, maintenance, and management simple.
FAQ's
A schema is a logical container for the database objects. It determines the Oracle APEX Engine Schema.
An Oracle Database consists of at least one database and one database. The database instance deals with memory and processes. The database consists of physical files, which are called data files and can be a non-container database or a multitenant container database.
APEX is currently a no-cost and fully-supported feature of Oracle; you can install a database anywhere an Oracle Database runs.
Conclusion
These two database architectures solve the problems faced when the data and business logic are placed within the Application Schema. Both database architectures are good, but you should select one based on the complexity of the application and scalability requirements. While the single database architecture is simpler, two databases allow for more granular scalability and flexibility of individual elements. Also, know the Oracle Apex pricing before getting one.