This page last changed on Jun 19, 2007 by rosie@atlassian.com.
To connect CrowdID to MySQL,
1. Configure MySQL
- Create a database user which Crowd will connect as (e.g. crowduser).
- Create a database for Crowd to store data in (e.g. crowdiddb).
This must be a different database to the one used by Crowd.
- 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
- Download the latest MySQL Connector/J JDBC driver.
- 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
- Edit the conf/Catalina/localhost/crowd.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&useUnicode=true&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 UTF-8 database - ie. created with create database crowdiddb character set utf8;. If you don't specify character set utf8 you risk getting 'Data truncation: Data too long for column' errors.
 | MySQL closes idle connection after 8 hours, so the autoReconnect=true is necessary to tell the driver to reconnect |
- Delete the minEvictableIdleTimeMillis, timeBetweenEvictionRunsMillis and maxActive attributes (which are only needed for HSQL, and degrade performance otherwise).
4. Configure CrowdID to use MySQL
- Edit the build.properties file (located in the root of the Standalone distribution) and modify the hibernate.dialect to the following, please only choose one of the 3 available options depending on how you have configured your database server.
- Then run the ./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:
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
|