title: Spring JDBC with Tomcat DBCP and multiple datasources
body: <p>I am using spring with have multiple datasources (catering to multiple mysql dbs) and using tomcat dbcp. I am getting some weird exceptions like </p>
  
  <ul>
  <li>procedure not found - when the proc is definitely  present in the db</li>
  <li>cannot borrow from pool - local dev setup, so definitely the pool is not full</li>
  </ul>
  
  <p>the Problem I feel might be this, need inputs from everyone:</p>
  
  <p>I have one <code>jdbcTemplate</code> object defined in my <code>spring.xml</code>, on every query that I need to fire, I call <code>jdbcTemplate.setDataSource()</code> to set the appropriate datasource and then use <code>simplejdbccall(jdbctemplate)</code> to execute the proc. </p>
  
  <p>Should I go in for also defining multiple <code>jdbcTemplate</code> objects, i.e. one for each datasource defined. The bean from where I am setting the datasource on the <code>jdbctemplate</code> and executing the stored proc is defined as <code>prototype</code>.</p>