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