This page last changed on Apr 10, 2007 by rosie@atlassian.com.

To connect Crowd to PostgreSQL, 

1. Configure PostgreSQL

  1. Create a database user which Crowd will connect as (e.g. crowduser).
  2. Create a database for Crowd to store data in (e.g. crowddb).
  3. Ensure that the user has permission to connect to the database, and create and populate tables

2. Copy the PostgreSQL driver to your application server

  1. Download the PostgreSQL JDBC driver from http://jdbc.postgresql.org/download.html. Get the JDBC 3 driver specific to your Postgres version, eg. + postgresql-8.x-xxx.jdbc3.jar.
  2. Add the PostgreSQL JDBC driver jar to the common/lib directory.

3. Configure your application server to connect to PostgreSQL

  1. Edit the conf/Catalina/localhost/crowd.xml and customise the username, password, driverClassName and url parameters for the Datasource.
    <Context path="/crowd" docBase="../../crowd-webapp" debug="0">
    
        <Resource name="jdbc/CrowdDS" auth="Container" type="javax.sql.DataSource"
                  username="[enter db username here]"
                  password="[enter db password here]"
                  driverClassName="org.postgresql.Driver"
                  url="jdbc:postgresql://host:port/database" [ see also http://jdbc.postgresql.org/doc.html) ]"
                  [ delete the minEvictableIdleTimeMillis, timeBetweenEvictionRunsMillis and maxActive params here ]
                />
    
        <Manager className="org.apache.catalina.session.PersistentManager" saveOnRestart="false"/>
    
    </Context>
  2. Delete the minEvictableIdleTimeMillis, timeBetweenEvictionRunsMillis and maxActive attributes (which are only needed for HSQL, and degrade performance otherwise).

4. Configure Crowd to use PostgreSQL

  1. Edit the build.properties file located in the root of the standalone release and modify the hibernate.dialect to the following
    hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
    
  2. Then run the ./build.sh or build.bat, this will configure crowd to use the PostgreSQL dialect.

If you do not wish to edit this file and run the build script, you can edit the jdbc.properties (which the above script modifies) directly. The jdbc.properties file is located here: crowd-webapp\WEB-INF\classes\jdbc.properties, modify the file to the following:

# - Crowd Configuration Options

hibernate.connection.datasource=java\:comp/env/jdbc/CrowdDS
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
hibernate.transaction.factory_class=org.hibernate.transaction.JDBCTransactionFactory

...

Next Steps

You should now have an application server configured to connect to a database, and Crowd configured to use the correct database. Now start up Crowd and watch the logs for any errors.

Related Topics

Document generated by Confluence on Jun 20, 2007 20:58