title: Configuring Spring to useMultiple Data Sources
body: <p>I am trying to connect 2 different <code>schemas</code> within my <code>spring boot</code> application. </p>
  
  <p>To do this I have got 2 different <code>data sources</code>. How should I configure this within my properties files? </p>
  
  <p>I seen <a href="https://stackoverflow.com/questions/30362546/how-to-use-2-or-more-databases-with-spring">this answer</a> which gave me an idea of how to do so. I currently have the following 3 property files in my application:</p>
  
  <pre><code>1. application.properties
  2. hibernate.properties
  3. multiple-db.properties
  </code></pre>
  
  <p><code>application.properties</code> is currently empty. Below are the other 2 files:</p>
  
  <p><strong>hibernate.properties:</strong></p>
  
  <pre><code># Connection configuration
  hibernate.connection.username= my_uname1
  hibernate.connection.password= my_pword1
  </code></pre>
  
  <p><strong>multiple-db.properties:</strong></p>
  
  <pre><code># Schema 1-Data source configuration
  oracle.db.username1= my_uname1
  oracle.db.password1= my_pword1
  oracle.db.url1= my_url1
  
  # Schema 2-Data source configuration
  oracle.db.username2= my_uname2
  oracle.db.password1= my_pword2
  oracle.db.url2= my_url2
  
  # JPA configuration
  spring.jpa.database-platform=org.hibernate.dialect.Oracle10gDialect
  
  # Hibernate configuration
  hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
  hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver
  hibernate.connection.url=my_url
  
  hibernate.connection.provider_class=org.hibernate.connection.C3P0ConnectionProvider
  </code></pre>
  
  <p>Is this the correct approach? Do I need 3 <code>properties files</code>, or could I do this all in one?</p>