cancel
Showing results for 
Search instead for 
Did you mean: 

Using External Databases with Activiti BPMN

anu86
Champ in-the-making
Champ in-the-making
I'm currently working with some business process creation using BPMN with Activiti. For one step in that business process I need to query a database and use that result in subsequent steps. So I'm looking for possible workarounds to integrate SQL operation capabilities to Activiti. So can anyone please suggest me whether is there any way to embed sql query capabilities for the activiti? Any suggestion for external database interaction for BPMN process using Activiti Engine is highly appreciated.

If such solution does not exists, any help on how to implement such feature for activiti also helpful
2 REPLIES 2

maudrid
Champ on-the-rise
Champ on-the-rise
I have not been using activity for a very long time, but my suggestion is to implement a new service task that connects to the external database.

I have a piece of code that I use to connect and creates a statement.
<code>
protected Statement createStatement(String dataSourceUrl, String dataSourceUsername, String dataSourcePassword){
     Connection conn = null;
Statement stmt = null;
     try {
         conn = DriverManager.getConnection(dataSourceUrl, dataSourceUsername, dataSourcePassword);
     } catch (SQLException e) {
      logger.error("Cannot get connection: " + e.getMessage());
         return null;
     }
    
     try {
         stmt = conn.createStatement();
     } catch (SQLException e) {
      logger.error("Cannot create statement: " + e.getMessage());
         return null;
     }   
     return stmt;
    }
</code>

anu86
Champ in-the-making
Champ in-the-making
Thanks a lot for the suggestion. Java Service Task will be a good approach for my problem. I will look in to that. Thanks for the explanation