Skip to main content

Extensibility and Integration



Connect to an External Database

You may want your applications to deal with information available in external databases. OutSystems allows you to do it and be able to consume your external database entities as any other entity in your application.

To connect to an external database and use its data in your application:

  1. Define a connection to the external database;
  2. Use an extension module to define entities for tables or views in the external database;
  3. Configure your extension to use the database connection;
  4. In your application, add a dependency to the extension;
  5. Use the entities of the extension as any other entity.

For a list of supported database engines using this procedure, see the System Requirements. In case you need to select the database based on runtime data, use the DatabaseConnection_SetConnectionStringForSession action of the PlatformRuntime API.


In the Sales app, we want to list the Order records with the Customer and Product information, and allow users to modify them. The data is stored in the customer, order and product tables of an external database called salesdb.

To connect to the salesdb database:

  1. Open the environment management console and open Administration > Database Connection;
  2. Set up a new database connection to your external database. The user defined in this database connection determines the privileges of access to the data, namely the ability to read, create, update or delete data.
  3. Call it SalesDB Connection;

  4. To map the database tables to entities you need to implement an extension module. Create a new extension and name it SalesDB_Connector;
  5. Right-click on the Entities folder and choose Connect to External Table or View...;
  6. Follow the steps in the interface to connect to the customer, order and product tables;
  7. Make sure you choose SalesDB Connection and salesdbwhen you are prompted to select database connection and database;
  8. In the Logical Database Name field, type Logical SalesDB. As result, the customer, order and product entities are defined in the extension;

  9. Click the 1-Click Publish button to publish it;

  10. After publishing the extension, you can configure the database connection that will be used by the logical database. In the dialog above, click Configure;
  11. In the environment management console, select the SalesDB Connection to be used by the extension;

    Connect to an External Database - Select Db in  Extension.png

  12. To use the extension, add a dependency to it in your application. The entities from the extension module became available after this. Now, you can create the screens that list and modify order records;

  • Was this article helpful?