If you want to use a database separate from Liferay DXP’s, follow these steps:
-
Specify your database and a data source name in your
service.xml
. -
Create the database manually.
-
Define the data source.
-
Connect your Service Builder module to the data source.
-
Run Service Builder.
There are two different ways to create the connection:
-
DataSourceProvider
: This approach involves implementing aDataSourceProvider
ServiceProviderInterface
(SPI). This way requires the fewest files and steps and works regardless of whether your Service Builder module uses theds
orspring
dependency injector. -
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.