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 general 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, create a database connection:
Open the Service Center management console of your OutSystems environment.
Tip: Open Service Center directly from Service Studio by clicking Environment Management...
On the Administration tab, select 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, use Integration Studio to create an extension that maps the tables or views in the external database to OutSystems entities:
Go back to Service Studio, open your Application, select New Module and create a new Extension Module.
In Integration Studio, Connect to your environment.
Right-click the Entities folder in the Extension 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.
Select 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.
In the 1-Click Publish summary window, select the Missing Configuration warning and then select Configure.
Configure the Extension to Use a Database Connection
After mapping the tables or views, use Service Center to configure which database connection the extension will use:
In Service Center, make sure you are in the Operation tab of Factory>Extensions><your extension name>,
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 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.