title: Configuring Hibernate to use database, whose name is not known before runtime
body: <p>I have a web application running on Java 6, Spring 2.5.6 and Hibernate 3.2.7. Now there is a requirement to fetch some data from several databases, whose names are not known before the runtime. What is the best way to achieve this?</p>
  
  <p>I have looked e.g. into the article at <a href="http://blog.springsource.com/2007/01/23/dynamic-datasource-routing/" rel="noreferrer">http://blog.springsource.com/2007/01/23/dynamic-datasource-routing/</a>, but that seems to be applicable only in a situation, where all the database configurations are known beforehand.</p>