How to acheive - Drools Workbench connection to database (ex. postgres)

948 views
Skip to first unread message

Sreehari Govind

unread,
May 20, 2015, 2:28:46 AM5/20/15
to drools...@googlegroups.com

Hi all,

I am new to Drools and need some help in clarifying a few things.

I am using "Kie-Drools-Workbench" docker container. This container has Drools and Postgres deployed on tomcat server.

I have a few simple rules written in Drools workbench, which basically perform simple mathematical operations and comparisons.

Now to test these rules, I am using the "Test Scenario" feature provided by Drools workbench.

My requirement is:- Instead of using the "Test Scenario" feature for giving inputs, I want to connect to a database and get the inputs from database rows. Is it possible to connect to any database from "Drools Workbench"(specifically) so that I can get these test inputs from the database?

If anything isn't clear, I can explain. Appreciate any help or leads. Thanks.

Michael Anstis

unread,
May 20, 2015, 3:31:25 AM5/20/15
to drools...@googlegroups.com
Hi,

The "out of the box" features do not support the ability to connect to a database from the workbench; especially not from the Test Scenario tool.

It is possible, however, you'd probably want to write your own Test Scenario editor to be able to retrieve the test inputs from a database. This assumes the Docker Container allows database connectivity (I assume it does within the same container). Personally I'd suggest using the Workbench to author your rules etc and then KieScanner and a custom Test Scenario tool that uses the KJAR authored in the workbench and inputs from a database.

With kind regards,

Mike 

--
You received this message because you are subscribed to the Google Groups "Drools Usage" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-usage...@googlegroups.com.
To post to this group, send email to drools...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-usage/499322c2-aef7-4ad8-8623-60104263dba6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sreehari Govind

unread,
May 26, 2015, 1:39:34 AM5/26/15
to drools...@googlegroups.com
Hi Mike,

Thanks a lot for your post. This helps me clarify things. 

Now I could author rules in workbench and use them as a JAR in eclipse. From eclipse I connect to the database, get any data I need, and apply them on the rules formulated.
So, in this case, Eclipse acts as "Custom Test Scenario tool" (as indicated by you)

Just a follow up question. Is the approach I have taken (explained above), a normal approach of using Drools or is there any other way am missing? Is there any other tool/software I could use as Test Scenario tool?

Also, how do I acheive - developing my own Test Scenario editor to be able to retrieve the test inputs from a database?? Any leads in this regard would help.

Thanks again.

Michael Anstis

unread,
May 26, 2015, 3:26:27 PM5/26/15
to drools...@googlegroups.com
Hi,

1) Using Eclipse to run your tests with the KJAR authored in the Workbench sounds a reasonable enough work-around (for the limitations of the Test Scenario that you need).

2) If you want to write your own Test Scenario tool (that is part of the Workbench) it's not too difficult; but you should familiarise yourself with GWT and UberFire. Obviously depending on what/how etc you want your new screen to work will drive the complexity of the code.. however adding it to the workbench is simple - provided it adheres to UberFire (all screens in the Workbench are written using the UberFire framework). 

--
You received this message because you are subscribed to the Google Groups "Drools Usage" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-usage...@googlegroups.com.
To post to this group, send email to drools...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages