How to convert a datasource to a direct JDBC connection

Still need help?

The Atlassian Community is here for you.

Ask the community

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.

  1. 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.

  2. Back up your test system's install folder, home folder, and database.

  3. 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.

    1. Create a new empty database in your database system.

    2. Install a new Crowd instance and set it up pointing to the new, empty database.

      1. 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.

    3. 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.

  4. Replace these values in the new file with the values from the test system:

    1. Database name

    2. Database username

    3. Database user password

  5. 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.

  6. Encrypt the database password.

  7. Shut down your test system.

  8. Rename the test system's crowd.cfg.xml  to a filename that won’t be picked up.

  9. Place the new system's crowd.cfg.xml  in the home directory of the test system.

  10. Start Crowd up again.

  11. If everything works in the live test system, you can apply this change to production:

    1. Shut down production.

    2. Back up your production Crowd install folder, home folder, and database.

    3. Modify the database connection information in the new crowd.cfg.xml  to the values of the production database. At this stage the new crowd.cfg.xml  has all the parameters to connect to the production system's database via Direct JDBC.

    4. Copy the file into the home directory of production.

    5. Restart production.

  12. Remove the new system as it's no longer required.

Last modified on Aug 13, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.