Execute old version of process instance

Hello everybody,

I’d like to know how to execute certain version of process instance through SQL statement. When a process is changed even slightly, Camunda creates a new version of the process instance and starts that last version. But sometimes I would like to proceed with the previous one without to use the Java or the REST API. What SQL can I execute in order to start a given version of the process instance in Camunda 7.1. ?

Thanks,
Borislav

Hi Borislav,

Your intention is hard to understand. Why do you want to use a SQL statement to start a process instance instead of using the Java API or REST API?

Cheers,
Thorben

Hi Thorben,

because I have only database access and can not use neither java nor rest. The access is restircted from our customer, so I can try to provide an sql script in order to execute the process instance.

Thank you
Borislav

Hi Borislav,

Note that Camunda is not supposed to be used by directly interacting with the database, since you may easily produce an inconsistent state that the process engine cannot handle.
Inserting a new process instance via SQL in a consistent state is therefore not a trivial task. Please understand that we cannot provide such a script here. If this is really what you want to do, I suggest you do the following:

  1. Set up a local Camunda installation
  2. Enable logging of SQL statements. Camunda uses MyBatis, so the MyBatis logging documentation and the Camunda MyBatis mappings should help you get started.
  3. Start a process instance via Java/REST API on that installation
  4. Examine the log and extract a SQL script

Once again, I can only advise against such a procedure since you can easily make things worse that way.

Cheers,
Thorben

1 Like

Hi Thorben,

I’m fully aware that changes in the data base could damage the data. Thus I will as far as possible first test that sql to be sure not to corrupt the data base. Thank you for your support and for provided suggestions!

Best
Borislav

By the way: Doesn’t database access imply that you are able to connect to the database via JDBC? In that case, can’t you just set up a Java application with an embedded process engine that starts the process instance? Or is your customer able to prevent this?

Cheers,
Thorben

In fact, I do not also have an data base access but want to provide that sql script to the customer. He could then execute it against his own data base without the need to install additional tools he ist not familiar with.

Thanks
Borislav