This page last changed on Oct 12, 2008 by smaddox.

To connect CrowdID to MySQL,

1. Configure MySQL

  1. Create a database user which CrowdID will connect as (e.g. crowduser).
  2. Create a latin1-encoded database for CrowdID to store data in (e.g. crowdiddb). This must be a different database to the one used by Crowd.
    create database crowdiddb character set latin1;
    

    At present, CrowdID does not support utf-8 encoding for MySQL. For more information, please refer to issue CWD-990.

  3. Ensure that the user has permission to connect to the database, and create and populate tables.

2. Copy the MySQL driver to your application server

  1. Download the latest MySQL Connector/J JDBC driver.
  2. Add the MySQL JDBC driver jar (mysql-connector-java-3.x.x-bin.jar) to the common/lib/ directory. NOTE: Do not place the Debug Driver (mysql-connector-java-3.x.x-bin-g.jar) on the CLASSPATH as this can cause issues. (JRA-8674).

3. Configure your application server to connect to MySQL

  1. Edit the file apache-tomcat-X.X.XX/conf/Catalina/localhost/openidserver.xml and customise the username, password, driverClassName and url parameters for the Datasource.
    <Context path="/openidserver" docBase="../../crowd-openidserver-webapp" debug="0">
    
        <Resource name="jdbc/CrowdIDDS" auth="Container" type="javax.sql.DataSource"
                  username="[enter db username here]"
                  password="[enter db password here]"
                  driverClassName="com.mysql.jdbc.Driver"
                  url="jdbc:mysql://localhost/crowdiddb?autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=latin1"
                  [ delete the minEvictableIdleTimeMillis, timeBetweenEvictionRunsMillis and maxActive params here ]
                />
    
        <Manager className="org.apache.catalina.session.PersistentManager" saveOnRestart="false"/>
    
    </Context>
    

    The URL above assumes a LATIN-1 database — i.e. created with create database crowdiddb character set latin1;.

    MySQL closes idle connections after 8 hours, so the autoReconnect=true is necessary to tell the driver to reconnect.
  2. Delete the minEvictableIdleTimeMillis, timeBetweenEvictionRunsMillis and maxActive attributes (which are only needed for HSQL, and degrade performance otherwise).

4. Configure CrowdID to use MySQL

  1. Edit the build.properties file (located in the root of the Standalone distribution) and modify the hibernate.dialect to the following. Please choose only one of the 3 available options depending on how you have configured your database server.
    *For MySQL set:*
    hibernate.dialect=org.hibernate.dialect.MySQLDialect
    *For MySQL with InnoDB set:*
    hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
    *For MySQL with MyISAM set:*
    hibernate.dialect=org.hibernate.dialect.MySQLMyISAMDialect
    
  2. Then run ./build.sh or build.bat. This will configure CrowdID to use the MySQL 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-openidserver-webapp\WEB-INF\classes\jdbc.properties. Modify the file to the following:

# - Crowd Configuration Options

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

...

Next steps

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

RELATED TOPICS
Document generated by Confluence on Jul 30, 2009 01:30