Thursday, October 21, 2010

Database connection settings

I have seen numerous post around database connection not working or portal server not starting properly due to the database connections not working properly.Many post including mine are available on Liferay forum for resolving the issue however I thought of making a checklist here for database connection settings.

Developer need to keep in mind that settings have been changing for every version in lower version till 5.1X DB setting were done in Root.xml , 5.2.X onwards all the setting entries are made in portal-ext.properties file
lets discuss the different version setting first.

Version 6.X and 5.2X have same config
put JDBC setting in portal-ext.properties
location : \\webapps\ROOT\WEB-INF\classes
< 6.X or 5.X>

copy your JDBC settings from portal.properties ---> ## JDBC section
get file from the downloaded source or tomcat setup or directly from SVN
SVN location : http://svn.liferay.com/repos/public/portal/trunk/portal-impl/src/portal.properties

username is : guest and password is : leave the password field blank

e.g.
# MySQL
#
#jdbc.default.driverClassName=com.mysql.jdbc.Driver
#jdbc.default.url=jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
#jdbc.default.username=
#jdbc.default.password=

Liferay 5.1.X and lower versions

Make JDBC changes in Root.xml
ROOT.xml can be found in tomcat\conf\Catalina\localhost\ROOT.xml

e.g. Sample setting get exact setting from portal.properties file
MySQL

Resource
name="jdbc/LiferayPool"
auth="Container"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8"
username=""
password=""
maxActive="20"


Set properties for schema
## Schema
##

#
# Set this to true to automatically create tables and populate with default
# data if the database is empty.
#
schema.run.enabled=true

#
# Set this to to true to populate with the minimal amount of data. Set this
# to false to populate with a larger amount of sample data.
#
schema.run.minimal=true


Checklist:
1> Make sure you have copied your database driver support
e.g. for oracle copy ojdbc14.jar to \\lib\ext

2> Test your DB availability and creation of schema
Schema name should match the schema name mentioned in jdbc.default.url

3>Check that you have correct version of driver support jar and is compatible with your your installation I have seen number of user facing problem due to incompatible version.

4> Check for proper character set settings for your database

Detailed Learning resource official documentation

1 comment:

jadvigafagerberg said...
This comment has been removed by a blog administrator.