OutSystems integrates with your existing databases. This allows you to develop applications that access data in external databases using OutSystems entities in Service Studio and without having to worry about data migration.
Integrating with external databases involves the following steps:
- In Service Center, define a connection to the external database;
- In Integration Studio, map tables or views in the external database to entities in an extension module;
- In Service Center, configure the extension to use a database connection;
- In Service Studio, reference and use the extension in your application.
For a list of supported external database engines check the System Requirements.
Define a Connection to the External Database
To use tables and views from external databases, you need to create a database connection:
In Service Center, under the tab Administration, click Database Connections;
Click New Database Connection and fill in the fields to set up the connection to the external database.
If you need to fine-tune the database connection, choose the option Advanced configuration. This allows you to define your own connection string;
Click Test to check if the connection is working correctly.
The database user must have permissions to:
- List the necessary tables and views in the external database;
- Perform the operations Create, Read, Update, and Delete on those tables and views.
Map Tables or Views to Entities in an Extension Module
After configuring a database connection in Service Center, you must use Integration Studio to create an extension that maps the tables or views in the external database to OutSystems entities:
In Integration Studio, connect to the environment where the database connection is configured;
Create a new extension, right-click the Entities folder in the tree and select Connect to External Table or View...;
Follow the steps of the wizard.
Make sure that you:
- Select the database connection configured previously;
- Select the necessary tables and views;
- Define a logical database name that you will use to connect the extension to a physical database connection in the next section.
After closing the wizard, review the imported entity names, descriptions and data types for each attribute;
Click the button 1-Click Publish to publish the extension module;
After publishing the extension, OutSystems warns you that you still need to configure which database connection the extension will use.
Configure the Extension to Use a Database Connection
To configure which database connection the extension will use, click the Configure button in the 1-Click Publish window. The button opens a configuration page in Service Center:
In Service Center, check that you are under the tab Factory, Extensions, your new extension, tab Operation;
Associate the logical database name of the extension to the database connection that the extension will use in runtime.
In some cases you need to select the database based on runtime data. Typically, the applicable databases share the same schema but they contain different data.
Use the extension in your application
The extension is now ready to be used in OutSystems applications:
In your application, click the button Manage Dependencies...;
Add a dependency to the extension and select the entities that you will use in your application.
You can now use the entities of the extension to manipulate data in the external databases just like you do with the standard OutSystems entities.