This documentation is for WSO2 App Factory 1.0.0. View documentation for the latest release.

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Datasource is the name given to the connection set up to a database from a server. You can configure datasources to connect to remote databases from App Factory. Each time you create a database, a respective datasource is automatically created in App Factory.

App Factory uses the same datasource name to connect the application with different databases in different environments.  When you promote/demote an application from one lifecycle stage to another, App Factory automatically connects it with respective databases using the same datasource name. This datasource uses a unique name but is registered with different connection details across different stages of the application's life cycle.

Figure 1: Same datasource name is registered in all environments

The four default App Factory user roles have different levels of permissions in creating and configuring datasources as shown below:


User RoleLevel of Permissions
App OwnerCan create and edit datasources in Development, Testing and Staging environments
DeveloperCan create and edit datasources in Development and Testing environments
QACan configure a datasource in Testing and Staging environments
DevOpsCan configure a datasource in Staging and Production environments

The section covers the following topics:

Table of Contents

Creating a datasource

Before you start creating a datasource, create a database using either the App Factory portal or externally in the respective RDBMS's workbench. After creating the database, follow the instructions below to create the datasource to connect to the database. 

  1. Log in to the App Factory portal (for the online version, try See the table above for information on which role can configure datasources in which lifecycle stage.
  2. Select an application from the list of apps that you own or are invited to participate in.
  3. Click the Resources tab from the left panel.   

  4. The Resource Overview page. 
  5. Click the Create Datasource button in the Overview page. Alternatively, you can go to the Datasources tab and click Create Datasource.
  6. Provide the necessary details in the form that opens and click Create Datasource. For example,
    Some of the fields are described below:

    Field NameDescription
    Database URLUrl to access the database JDBC URL FORMAT: jdbc:mysql://<host>:<port>/<database_name>
    Database DriverOnly mysql database driver is supported. In future other drivers will be supported.
    Username/PasswordThe given credentials while creating the database.

    If the check boxes are checked, this datasource will be copied to Testing and/or Staging.

    Reusing the datasource in different environments

  7. You can configure the same datasource to point to different databases in different stages of the lifecycle. To do this, click on the name of the datasource and edit its Stage and database connection details.


    The Stage drop-down list is populated only by the lifecycle stages the current user has access to. For example, if you are added to this application as a QA person, you have permission to configure datasources only in Testing and Staging life-cycle stages. Therefore, the Stage drop-down list will be populated only by those two stages. You can read more about datasource editing permissions above.

  8. After creating the datasource, you can use it in your applications as follows.

Also see sample Reusing a Datasource in all Lifecycle Stages. It explains how to define a datasource for an application and how to use it to point to different databases in different lifecycle stages of the application.