Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: External Database Connectivity not happening in 7.3
Hi Team ,
We are using external database for storing user encrolled
courses information purpose . so In 7.0 we are happiely working with
external database , Now we are migrating our module service builder
from 7.0 to 7.3 . but this much configuration not working with 7.3 and
we are getting getService() as null always because
of ependency-injector="spring" . so what are the new
configurations requires for accessing external database in 7.3 ?
I am adding my service.xml file below :
<?xml version="1.0"?>
<!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 7.3.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_7_3_0.dtd">
<service-builder dependency-injector="spring" package-path="com.sakai.external.services">
<namespace>sakai</namespace>
<entity name="SakaiService" local-service="true" remote-service="false" data-source="liferayDataSource">
<column name="sakaiServiceId" type="long" primary="true"></column>
</entity>
</service-builder>
and the service.xml defined data-source Id , we mentioned
inside ext-spring.xml :
<?xml version="1.0"?>
<beans default-destroy-method="destroy" default-init-method="afterPropertiesSet"
xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<!-- To define an external data source, the liferayDataSource Spring bean
must be overridden. Other default Spring beans like liferaySessionFactory
and liferayTransactionManager may optionally be overridden.
liferayDataSourceFactory refers to the data source configured on the
application server. -->
<bean class="com.liferay.portal.dao.jdbc.spring.DataSourceFactoryBean"
id="liferayDataSourceFactory">
<property name="propertyPrefix" value="jdbc.sakai.mysql." />
</bean>
<!-- The data source bean refers to the factory to access the data source.
-->
<bean
class="org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy"
id="liferayDataSource">
<property name="targetDataSource" ref="liferayDataSourceFactory" />
</bean>
<!-- In service.xml, we associated our entity with the extDataSource. To
associate the extDataSource with our overridden liferayDataSource, we define
this alias. -->
</beans>
and the same prefix , we added inside portal-ext.properties :
jdbc.sakai.mysql.driverClassName=com.mysql.jdbc.Driver
jdbc.sakai.mysql.url=jdbc:mysql://**MySAKAIURL**/sakai12?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
jdbc.sakai.mysql.username=***
jdbc.sakai.mysql.password=***
is anything extra configuration require in 7.3 ?
Hi Pradeep,
Did you got any solution on this?
We are facing same issue with Liferay DXP 7.3 with External database Oracle 19c.
Thanks
Hi Bharamani ,
sorry for the late response .
yeah , I got solution
.
once refer the below youtube link
https://www.youtube.com/watch?v=F1Q0SK4XCAM&t=8s
Thanks