cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing activiti database tables from java code

firzhan
Champ in-the-making
Champ in-the-making

How can I access the activiti database tables by using custom java code ?
5 REPLIES 5

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Firzhan,

You can use the same DB connection settings and connect to the any DB (activiti too).

Regards
Martin

Hi Martin,

Thanks for your prompt response.

My requirement  is to store the BPMN package name with the check-sum value in the activiti DB. By doing so I can avoid users uploading same packages in to the system.

I am planning to use a separate new table in the activiti DB for this task. I am running activiti from a java server.

My question is how can I insert the above mentioned values in to the table by using activiti engine without having external connection with the activiti DB?

Thanks in advance


jbarrez
Star Contributor
Star Contributor
You can get access tot he connection through the DbSqlSession.getSqlSession() object, that one has the current connection.

firzhan
Champ in-the-making
Champ in-the-making
Hi jbarrez,

Where can I find a sample to go through on accessing the connection using   DbSqlSession.getSqlSession() object.

Any help or reference materials are appreciated

trademak
Star Contributor
Star Contributor
Hi Firzhan,

You can look at the implementation of the org.activiti.engine.impl.cmd.ExecuteCustomSqlCmd class for a good example.
For custom SQL you can also use the ManagementService executeCustomSql method.

Best regards,