protected NamedParameterJdbcTemplate getValidateJdbcTemplate(Object params) {
   DataSource targetDataSource = DataSourceContext.getDataSource();
   DataSource routeDataSource = routeDataSource(routeConfigDefault, params);
   if (targetDataSource == null) {
     return new NamedParameterJdbcTemplate(routeDataSource);
   }
   if (!targetDataSource.equals(routeDataSource) && routeDataSource != null) {
     throw new RuntimeException(
         "Could not operate different DataSouce["
             + targetDataSource
             + ", "
             + routeDataSource
             + "]");
   }
   return new NamedParameterJdbcTemplate(targetDataSource);
 }
  private Integer getFoo(DataSource ds) throws Exception {
    Connection c = null;
    Statement s = null;
    Integer value = null;
    try {
      c = ds.getConnection();
      s = c.createStatement();
      String tablename = (ds.equals(myDS) ? TABLE1 : TABLE2);
      ResultSet results = s.executeQuery("select foo from " + tablename + " where id=1");
      if (results.next()) value = new Integer(results.getInt(1));

      results.close();

      return value;
    } finally {
      if (s != null) s.close();
      if (c != null) c.close();
    }
  }