Message Boards

RE: how to use ext-spring.xml

Kevin Gokani, modified 4 Years ago.

RE: how to use ext-spring.xml

New Member Posts: 6 Join Date: 10/16/19 Recent Posts
Hi,I am also trying to use multiple data source in my portal(7.2CE). So i did following things :-step 1: created a service builder.step 2: Defined entity in service.xmlstep 3: Defined the external source in portal-ext.properties
step 4:build servicestep 5: Made ext-spring.xml in META-INF folder of servicebuilder-service.step 6: Utilized the service in a mvcPortlet class.The problem that it is creating is that it is using the default database defined in the portal-ext.properties and not the one which is defined as "external", i.e it is searching for the table in default database and gives an error stating that "defaultDatabase.table doesn't exist "
I hope someone has the solution for it.Thank you in advance.
thumbnail
Olaf Kock, modified 4 Years ago.

RE: how to use ext-spring.xml

Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent Posts
Kevin Gokani:

Hi,I am also trying to use multiple data source in my portal(7.2CE).
I've split this thread from the original 9 years old message, which is quite irrelevant for 7.2 CE.
You might want to try https://github.com/amusarra/sb-extdb or the original  https://github.com/dnebing/sb-extdb and the blog article at the root of it all, https://liferay.dev/blogs/-/blogs/liferay-7-service-builder-and-external-databases
Kevin Gokani, modified 4 Years ago.

RE: how to use ext-spring.xml

New Member Posts: 6 Join Date: 10/16/19 Recent Posts
Hi olaf,
These links gave me an alternative method to use multiple data source in liferay i.e by implementing the interface DataSourceProvider. And it worked fine.
Thank you.