To connect CrowdID to MS SQL Server,
1. Configure SQL Server
- Create a database user which CrowdID will connect as (e.g. crowduser).
In SQL Server, the database user (crowduser above) should not be the database owner, but should be in the db_owner role. |
- Create a database for CrowdID 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 SQL Server driver to your application server
- Download the SQL Server JDBC driver from JTDS (recommended, assumed below), or I-net software (commercial).
Microsoft have their own JDBC driver but we strongly recommend avoiding it after our JIRA customers have reported various connection errors ([JRA-5760|http://jira.atlassian.com/browse/JRA-5760], \[JRA-6872\|http://jira.atlassian.com/browse/JRA-6872), workflow problems ([JRA-8443|http://jira.atlassian.com/browse/JRA-8443]) and Chinese character problems ([JRA-5054|http://jira.atlassian.com/browse/JRA-5054]). |
|
Add the SQL Server JDBC driver jar (jtds-\[version\].jar) to the {{common/lib}} directory. |
3. Configure your application server to connect to SQL Server
- 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="net.sourceforge.jtds.jdbc.Driver"
url="jdbc:jtds:sqlserver://localhost:1433/crowdiddb"
[ delete the minEvictableIdleTimeMillis, timeBetweenEvictionRunsMillis and maxActive params here ]
/>
<Manager className="org.apache.catalina.session.PersistentManager" saveOnRestart="false"/>
</Context>
|
- Delete the minEvictableIdleTimeMillis, timeBetweenEvictionRunsMillis and maxActive attributes (which are only needed for HSQL, and degrade performance otherwise).
4. Configure CrowdID to use MS SQL Server
- Edit the build.properties file (located in the root of the Standalone distribution) and modify the hibernate.dialect to the following:
hibernate.dialect=org.hibernate.dialect.SQLServerDialect
|
- Then run the ./build.sh or build.bat. This will configure CrowdID to use the MS SQL Server dialect.
There is a problem with build.bat in Crowd version 1.2.0. To fix the problem, please apply the patch described in CWD-638.
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.SQLServerDialect
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