Accessing databases in servicemix-drools
ServiceMix provides a Service Engine for Drools , the famous Rules Engine. People often want to retrieve data from the rules and such data is usually stored in a database. Previously there was no easy way to configure a DataSource and inject it in the rules definitions. This is a small enhancement that I've just written and that will be included in next major release. So let's say you write your database access code in a simple helper object: import javax.sql.DataSource; import org.springframework.jdbc.core.JdbcTemplate; public class DbHelper { private DataSource dataSource; private JdbcTemplate jdbcTemplate; public void setDataSource(DataSource dataSource) { this.dataSource = dataSource; this.jdbcTemplate = new JdbcTemplate(dataSource); this.jdbcTemplate.afterPropertiesSet(); } public String getSurname(String name) { String surname = (String) this.jdbcTemplate .queryForObject( "select surname from t_...