How to convert a datasource to a direct JDBC connection
Purpose
If you currently connect to your Crowd database via a datasource configured in your server.xml
and you want to use a direct JDBC connection configured in crowd.cfg.xml
instead, this document will help you do that.
Solution
These steps will take you through performing this process in a test system first to ensure the process works smoothly, before applying to production.
Create a new Crowd instance using a backup of your production system. For the rest of these steps we will call this the test system.
Back up your test system's install folder, home folder, and database.
Generate a new
crowd.cfg.xml
with all the parameters filled out automatically by installing a new version of Crowd. For the rest of these steps we will call this the new system.Create a new empty database in your database system.
Install a new Crowd instance and set it up pointing to the new, empty database.
If at this point you receive a warning about overwriting content in the database, don’t proceed. This means you’re accidentally pointing to your production or test database, or a database that has Crowd data in it already. Check your configuration of the new system, especially
<crowd-install>/crowd/WEB-INF/classes/crowd-init.properties
, and start again.
Once the new system has started, compare the
crowd.cfg.xml
file to your current one. Make a note of any differing values, e.g. c3p0.maxSize, hikari etc.
Replace these values in the new file with the values from the test system:
Database name
Database username
Database user password
Make any changes to the parameters of the new config file that you noted in step 3-c above. At this stage the new system's
crowd.cfg.xml
has all the parameters to connect to the test system's database via Direct JDBC.Shut down your test system.
Rename the test system's
crowd.cfg.xml
to a filename that won’t be picked up.Place the new system's
crowd.cfg.xml
in the home directory of the test system.Start Crowd up again.
If everything works in the live test system, you can apply this change to production:
Shut down production.
Back up your production Crowd install folder, home folder, and database.
Modify the database connection information in the new
crowd.cfg.xml
to the values of the production database. At this stage the newcrowd.cfg.xml
has all the parameters to connect to the production system's database via Direct JDBC.Copy the file into the home directory of production.
Restart production.
Remove the new system as it's no longer required.