Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Integrating Existing Databases into Rollbase External Tables

DZone's Guide to

Integrating Existing Databases into Rollbase External Tables

Rollbase helps you create apps with speed and efficiency. Learn how easy it is to develop applications in Rollbase that can reuse your existing data.

· Database Zone ·
Free Resource

Running out of memory? Learn how Redis Enterprise enables large dataset analysis with the highest throughput and lowest latency while reducing costs over 75%! 

In this tutorial, you'll learn how to easily integrate data from your existing database tables into your Rollbase application.

In this blog, we will look at how we can integrate an existing database into Progress Rollbase applications. Rollbase is a low-code platform that helps create all sorts of applications at unprecedented speed and efficiency. In most cases, you probably intend to modernize your existing applications to an all new user interface and experience. This can be easily achieved with Rollbase external database support. This feature is only available on the private cloud.

Purpose and Prerequisites

We will build an Application in Rollbase that will have:

  • Employee and Department as objects.
  • 1:M relationship between Department and Employee.

As a prerequisite, we need to have a database schema with two tables (Employee and Department) as:

  • Employee table with employee ID, name, and department ID columns.
  • Department table with department ID, and name column.
  • Both these tables have some data.

Setting up Rollbase on the Existing Database Schema

Rollbase installation comes with SQL files for four databases:

  1. Oracle (create_ora.sql).
  2. MySQL (create_mysql.sql).
  3. MSSQL (create_ms.sql).
  4. OpenEdge (create_oe.sql).

For the purpose of this blog, we will use the MySQL version and MySQL workbench. We will now run 'create_mysql.sql' script to install Rollbase tables on the existing schema.

Your database schema (rb_dbo) will now have existing tables (Department, Employee) and Rollbase tables (tables that start with rb_).

Let's take a quick look at the data from the Employee and Department tables.

Configuring a Database in Rollbase

We will configure databases.xml in Rollbase to point to this schema with External flag set. You can also set this using the Manage databases section in the System Console app.

Creating Applications in Rollbase

Let's start building our application in Rollbase with objects accessing data from the existing tables.

As a first step, we will create an application from External Table Demo in Rollbase by launching the Application create wizard and clicking on Let me build it my way.

Creating External Objects in Rollbase

We will now create the Department object that points to the Department table in the schema. In order to this, we should choose the A new Object (with Tab) from an External Metadata option from the object create popup.

Choose the External Tables option on the Import Object Metadata page and click Next.

Choose the department table from the dropdown and a name column. Now, provide a name for the Rollbase object that will point to this database table and click Create Object.


Choose a primary key for the Department table viz. id and click Create Fields. This will now create fields in the Department object and associate them with the respective database columns. In this page, you can set Rollbase field details such as their label, field type, uniqueness constraints, etc.


In the Adjust SQL page, you will see options to configure your SQL queries for the CRUD operations on the Department object:

Follow the same steps to create the Employee object that points to the Employee table in the schema. During this configuration, make sure you select the department_id column as a foreign key in the Create Fields page. This will automatically create a 1:M relationship in Rollbase between Employee and Department objects.

The Department and Employee tabs in the application now show the data from their respective database tables:

Let's now create an Employee for the Finance Department. This will also create an entry in the Employee table.

Let's now query the Employee table and verify the new Employee entry.

Conclusion

To conclude, we learned how easy it is to develop applications in Rollbase that can reuse your existing data. There is comprehensive documentation on this subject here.

Running out of memory? Never run out of memory with Redis Enterprise databaseStart your free trial today.

Topics:
database ,rollbase ,tutorial ,app development

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}