Connecting Service Builder to an External Database

If you want to use a database separate from Liferay DXP’s, follow these steps:

  1. Specify your database and a data source name in your service.xml.

  2. Create the database manually.

  3. Define the data source.

  4. Connect your Service Builder module to the data source.

  5. Run Service Builder.

There are two different ways to create the connection:

  1. DataSourceProvider: This approach involves implementing a DataSourceProvider ServiceProviderInterface (SPI). This way requires the fewest files and steps and works regardless of whether your Service Builder module uses the ds or spring dependency injector.

  2. Spring Beans: Configure the connection using Spring XML files. This approach only works with Service Builder modules that use the spring dependency injection option.

Since DataSourceProvider is the easiest, most versatile approach, it’s explained first.

« Configuring service.propertiesConnecting the Data Source Using a DataSourceProvider »
Was this article helpful?
0 out of 0 found this helpful