Need to establish database connectivity in drools to get some data as and when required while executing the rules. How do I go about that?
Drools function will look like as:
function String ConnectDB(String ConnectionClass,String url,String user, String password) {
Class.forName(ConnectionClass);
java.sql.Connection con = DriverManager.getConnection(url, user, password);
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("select * from Employee where employee_id=199");
rs.first(); return rs.getString("employee_name");
}
Take a look at sample project https://github.com/abhijithumbe/jbpm6Examples/tree/master/Drools_DBConnection