Database connection pool C3po configuration in liferay
In Liferay, default connection pool is c3p0 configured using portal-ext.properties. Liferay Portal also supports the database connection pool configuration through the Application Server.
Liferay can access the Application Server level data source using JNDI. It is recommended to use the JNDI-based database connection pool configuration.
Add the following property in the portal-ext.properties.
jdbc.default.jndi.name=jdbc/LiferayPool
Open the server.xml in the <liferay-home>/tomcat/conf folder
Locate the Resource tag and add the following properties.
<Resource
auth="Container"
description="Portal DB Connection"
driverClass="com.mysql.jdbc.Driver"
maxPoolSize="75"
minPoolSize="10"
acquireIncrement="5"
name="jdbc/LiferayPool"
user="<MySQL Database User Name>"
password="<MySQL Password>"
factory="org.apache.naming.factory.BeanFactory"
type="com.mchange.v2.c3p0.ComboPooledDataSource"
jdbcUrl="jdbc:mysql://<MySQL Database Server IP>:3306/lportal?useUnicode=true&characterEncoding=UTF 8&useFastDateParsing=false"/>
We should fill the appropriate values in the properties like user , password etc with your values.
Then we should add these 2 libraries in the tomcat/lib folder. We can get these lib's in the <liferay-home>/tomcat/webapps/ROOT/WEB-INF/lib folder.
1.c3p0.jar
2.mchange-commons-java.jar.
Thats it Restart the server. We have configured the liferay with c3po connection pool using JNDI
Liferay can access the Application Server level data source using JNDI. It is recommended to use the JNDI-based database connection pool configuration.
Add the following property in the portal-ext.properties.
jdbc.default.jndi.name=jdbc/LiferayPool
Open the server.xml in the <liferay-home>/tomcat/conf folder
Locate the Resource tag and add the following properties.
<Resource
auth="Container"
description="Portal DB Connection"
driverClass="com.mysql.jdbc.Driver"
maxPoolSize="75"
minPoolSize="10"
acquireIncrement="5"
name="jdbc/LiferayPool"
user="<MySQL Database User Name>"
password="<MySQL Password>"
factory="org.apache.naming.factory.BeanFactory"
type="com.mchange.v2.c3p0.ComboPooledDataSource"
jdbcUrl="jdbc:mysql://<MySQL Database Server IP>:3306/lportal?useUnicode=true&characterEncoding=UTF 8&useFastDateParsing=false"/>
We should fill the appropriate values in the properties like user , password etc with your values.
Then we should add these 2 libraries in the tomcat/lib folder. We can get these lib's in the <liferay-home>/tomcat/webapps/ROOT/WEB-INF/lib folder.
1.c3p0.jar
2.mchange-commons-java.jar.
Thats it Restart the server. We have configured the liferay with c3po connection pool using JNDI
what if i set initial pool size to 5 and minimum pool size to 10
ReplyDelete