You can Setup a Java Service Task as instructed here and implement your custom logic that may or may not include interraction with an external DataBase. Just remember to save the output of your service task to your process variables (execution) in case you need it for further processing (review for example, ...)
Here is a sample BPMN Service task:
<serviceTask id="javaService"
name="My Java Service Task"
activiti:class="org.activiti.MyJavaDelegate" />
And here is a sample implementation for it :
public class ToUppercase implements JavaDelegate {
public void execute(DelegateExecution execution) throws Exception {
String var = (String) execution.getVariable("input");
var = var.toUpperCase();
execution.setVariable("input", var);
}
}
Do not forget to manage your DB connection pools, ... etc so that you do not any unnecessary problems in production
EDIT :
I couldn't detect any thing from that blog post your referenced in your comment that may not function correctly in activiti community edition, just remember to make all your custom classes and dependencies available on your classpath.
Note :
The post from the blog post is talking about the embedded activiti engine in alfresco (in that case it was Enterprise Edition), but yet again, it should work fine even with the community edition of activiti!