Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Kan Kon
DB Connection Pool Settings
August 31, 2012 11:42 AM
Answer

Kan Kon

Rank: New Member

Posts: 23

Join Date: September 12, 2011

Recent Posts

What is the correct configuration for configuration db connection pool for 6.1? Is it ROOT.xml or portal properties file? There is a confusion because the deployment checklist document suggests to tune in ROOT.xml but portal.properties already has c3p0 connection pool properties.

portal.properties file
 1#
 2    # The following properties will be read by C3PO if Liferay is configured to
 3    # use C3PO in the property "jdbc.default.liferay.pool.provider". See
 4    # http://www.mchange.com/projects/c3p0/index.html#configuration for a list
 5    # of additional fields used by C3PO for configuring database connections.
 6    #
 7    jdbc.default.acquireIncrement=5
 8    jdbc.default.acquireRetryAttempts=3
 9    jdbc.default.acquireRetryDelay=1000
10    jdbc.default.connectionCustomizerClassName=com.liferay.portal.dao.jdbc.pool.c3p0.PortalConnectionCustomizer
11    jdbc.default.idleConnectionTestPeriod=60
12    jdbc.default.maxIdleTime=3600
13    jdbc.default.maxPoolSize=100
14    jdbc.default.minPoolSize=10
15    jdbc.default.numHelperThreads=10
16    #jdbc.default.transactionIsolation=1


ROOT.xml

 1<Resource
 2auth=”Container”
 3description=”Portal DB Connection”
 4driverClass=”com.mysql.jdbc.Driver”
 5maxPoolSize=”75”
 6 minPoolSize=”10”
 7acquireIncrement=”5”
 8name=”jdbc/LiferayPool”
 9user=”XXXXXX”
10password=”XXXXXXXXX”
11factory=”org.apache.naming.factory.BeanFactory”
12type=”com.mchange.v2.c3p0.ComboPooledDataSource”
13jdbcUrl=”jdbc:mysql://someServer:3306/lportal?useUnicode=true&amp;characterEncoding=UTF-8&amp;useFastDateP arsing=false”/>


What is the correct configuration?
David H Nebinger
RE: DB Connection Pool Settings
August 31, 2012 11:55 AM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 11770

Join Date: September 1, 2006

Recent Posts

Depends on whether you're using a JNDI data source lookup or a direct JDBC connection.

If the JNDI approach, the ROOT.xml contains the resource definition for the datasource and the c3p0 tweaking goes here.

For the JDBC connection, ROOT.xml will not have the resource definition and you'll define your properties in the portal-ext.properties, and the c3p0 tweaking goes here.

It's really a choice whether you want the database connection managed at the application container level or at the Liferay level. Ideally if it is at the application container level, the connection pool can be shared by other web applications (only if you move the resource from the ROOT.xml to the global server.xml file).

Otherwise it makes little difference which way you go.
Mika Koivisto
RE: DB Connection Pool Settings
August 31, 2012 3:41 PM
Answer

Mika Koivisto

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1513

Join Date: August 7, 2006

Recent Posts

Like David said you can either use JNDI datasource or let Liferay create the datasource. I personally prefer the JNDI datasource approach. I recently blogged about configuring c3p0 connection pool for Liferay on Tomcat.
Hitoshi Ozawa
RE: DB Connection Pool Settings
September 1, 2012 4:15 AM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7949

Join Date: March 23, 2010

Recent Posts

If you're using 6.1, the first time you start liferay, setup page should be displayed where you can specify jdbc connection. Settings specified here is saved in the portal-setup-wizard.properties. It's probably better to specify connection pool in portal-ext.properties (note, not in portal.properties) in this circumstance.

Liferay documents are sometimes confusing because there are different ways to do the same thing in liferay.