title: How to use Spring to manage connection to multiple databases
body: <p>I have read other topics but didn't find a good and clear answer</p>
  
  <p>What I'm trying to is to develop a web app which is able to:</p>
  
  <p>1) Log/track user events in a seperate UI database which we connect via hibernate with the same database schema (maybe save connectionString to the different oracle databases)</p>
  
  <p>2) At runtime when you log in you can choose an environment to connect to one of the three different oracle databases that have the same schema (but not the same data)</p>
  
  <p>3) provide the correct DataSource with username and password (where to get this sensitive data? I would not keep this stored somewhere in the application)</p>
  
  <p>I'm fairly new to the Spring framework. I found this <a href="http://blog.springsource.com/2007/01/23/dynamic-datasource-routing/" rel="nofollow">link</a> which could be a first lead.</p>
  
  <p>Any suggestions?</p>
  
  <p>Also using Spring 3.1 or 3.2, JDBC to query to my oracle database and hibernate mapping to my UI database. This sounds quite confusing so I have a picture:</p>
  
  <p><a href="http://imageshack.us/photo/my-images/838/infrastructurearchitect.jpg" rel="nofollow">infrastructure</a></p>