I'm setting up some test scaffolding around an existing project. This includes some integration tests, using JUnit and DbUnit. I've also set up a Jenkins installation for continuous integration.
My problem involves changing the DB connections between the development and testing environments. I have my own product stack installed locally for quick ad-hoc testing and investigation. As I'm developing, I run tests against my private database, since it's faster and I won't ruin anybody else's day with buggy work-in-progress code.
Once code is checked in, Jenkins will run my tests. Right now it's still pointing at my local db. I'd prefer to have Jenkins run tests against a different database, one that is in the test environment.
Is there a best practice / strategy / technology / etc. for changing database connections for testing without having to change code? Bonus points if the solution allows Jenkins to run the same tests against multiple DBs (should be possible since DbUnit is agnostic).
Edits for more info:
The product is a large one, with dozens of different interacting components (usually in separate vms / processes). In a live system, the different processes typically communicate through the database. IE, the UI process writes changes to a table and the back-end process polls that table for changes. Yes, it's awful. For integration testing, I configure a system using the UI and capture that state with DbUnit. I can then run tests against that "input."
My component, and all new components, are managed by maven. DB Connections are currently hard-coded in the test setup. The DbUnit system works; I'd just like to be able to switch which database my tests are referencing depending on whether they're being run by me in my development environment, or run by Jenkins in the testing environment.