Connecting Jbpm With External dataSource / External Database / Mysql Database
PINNINTI SAI SUKUMAR
Posted on October 29, 2022
Writing this Article For Reference and this might help others .
I, am New to JBPM , if Anything Mentioned In the article is Wrong Please Suggest it in the comments .
Reference video:
In Order Use Execute-Sql-Work-Item-Handler:
Please Follow this Video Guide From YouTube:
jBPM ExecuteSqlWorkItemHandler | KIE TUTORIALS
- - - - -
Installing
- - - - - - -
`Please make sure that you have toggled the Execute-Sql in the Custom Tasks Administration section.
Steps to Follow :
- Click on the gear icon in the nav bar, scroll down and open Custom Tasks Administration .
- Search for Execute-Sql and toggle it to the yes state. If prompted for jndi name just add : java:jboss/datasources/ Adding Dependencies In order to add external Data source, Navigate to your:
- Project> Settings >Deployments> Work Item handlers >
- Add a new Work Item Handler
`
- Name: ExecuteSQL
Value:
new org.jbpm.process.workitem.executesql.ExecuteSqlWorkItemHandler("java:jboss/datasources/")Resolver type: MVEL
`Navigate to Dependencies and add a dependency From [Here][2] .
Or elseGroupID : org.jbpm.contrib | Artifact ID : execute-sql-workitem | Version : 7.42.0.Final
Save the Configuration and the Create the Business Process as required.`
- - - - -
Drivers Deployment
- - - - - - - - -Download the Zip from below link
[mysqljdbcdriver.zip][3]
-
Extract the zip and copy the mysql-connector-java-5.1.47-bin.jar file.
Navigate JBPM Installation Folder \standalone\deployments
paste the file there. -
Navigate to JBPM Installation Folder \modules\com
- Create folder named: Mysql
- Inside mysql folder create a folder named main.
The main Folder Directory would look like:
JBPM Installation Folder \modules\com\mysql\main
-
Navigate to JBPM Installation Folder \bin\drivers
- Copy mysql-connector-java.jar file.
- Repeat the Steps 2 and 3
- Navigate to JBPM Installation Folder \modules\com\mysql\main Paste the file.
- Create a .xml file named module.xml.
- The Contents of the module.xml file is: <?xml version='1.0' encoding='UTF-8'?> Adding The External Data Source - - - - - - - - - - - - - - - -
Now open Another Terminal in the bin and Execute the Following Command "
jboss-cli.bat -c
"-
Configure Your DataSource From the Below Command :
xa-data-source add - name=
- jndi-name="java:/jboss/datasources/" - user-name=jbpm - password=jbpm - driver-name=mysql-connector-java.jar - xa-datasource-class=com.mysql.jdbc.jdbc2.optional.MysqlXADataSource - xa-datasource-properties=[{ServerName=localhost,PortNumber=3306,DatabaseName=}] *replace & with the with database name.and the other parameters with their respective values .
Now You can Use the External DataSource .
Reference Links
For PostgreSql : https://karinavarela.me/2020/06/17/persisting-custom-data-configuring-external-persistence/
MySql : http://www.mastertheboss.com/bpm/jbpm6/configuring-jbpm-to-use-mysql-as-database/
[2]: https://mvnrepository.com/artifact/org.jbpm.contrib/execute-sql-workitem/7.42.0.Final
[3]: https://dbschema.com/jdbc-drivers/MySqlJdbcDriver.zip
Posted on October 29, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.