Integrating an Existing Database into Rollbase External Tables

Integrating an Existing Database into Rollbase External Tables

Posted on May 16, 2017 0 Comments
Integrating an Existing Database into Rollbase External Tables_870x220

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 private cloud.

Purpose and Prerequisite

We will build an Application in Rollbase which 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' & 'Department' as:

  • Employee table with employee ID, name & department ID columns
  • Department table with department ID & 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_').

External-Table-schema

Let's take a quick look at the data from the 'employee' and 'department' tables.

External-Table-department

External-Table-employee

Configuring 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 System Console app.

External-Table-databases-1024x106

Creating Application 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 'External Table Demo' in Rollbase by launching the Application create wizard and click on 'Let me build it my way.'

External-Table-application

Creating External Objects in Rollbase

1. 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 popupExternal-Table-object-create
  • Choose the 'External Tables' option in the 'Import Object Metadata' page and click on 'Next'
External-Table-object-create-step-1
  • 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 on 'Create Object.'

    External-Table-object-create-step-2-1024x347


  • Choose a primary key for the 'department' table viz. 'id' and click on '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 constraint etc.
    External-Table-object-create-step-3

  • In the 'Adjust SQL' page, you will be see options to configure your SQL queries for the CRUD operations on the Department object
    External-Table-object-create-step-4-1024x418
2. 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 'Create Fields' page. This will automatically create a 1:M relationship in Rollbase between Employee and Department object. External-Table-object-create-step-5-1024x350

3. The 'Department' and 'Employee' Tabs in the Application now show the data from their respective database tables
External-Table-department-data

External-Table-employee-data

4. Let's now create an Employee for the Finance Department. This will also create an entry in the 'employee' table.
External-Table-employee-create

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

External-Table-employee-create-database-verify

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.

Curious to learn more about Rollbase? Find out more here, or dive right in with a free 30 day trial at the link below (if you want a private cloud, be sure to choose that option).

Try Rollbase Now

Manooj-Murali

Manooj Murali

Manooj Murali is a Principal Software Engineer at Progress. He has been part of the Rollbase development team in Hyderabad for more than two years and has more than 8 years of experience overall in software development. He has led many feature developments like I18N, Marketplace, White-Labelling, JBOSS support, High Availability and more for Rollbase.

Comments

Comments are disabled in preview mode.
Topics

Sitefinity Training and Certification Now Available.

Let our experts teach you how to use Sitefinity's best-in-class features to deliver compelling digital experiences.

Learn More
Latest Stories
in Your Inbox

Subscribe to get all the news, info and tutorials you need to build better business apps and sites

Loading animation