Insert records in database and output stored data in database (SQL Server)


Hi Guys,

Who knows the step by step and sample code in inserting data into database and how to view the content of database in the UI Designer. I have 2 tables header and details. Please help. Please send sample code or sample bos file. Version of bonita is 7.4.2 Community Edition. I'm using sql server as database.


Submitted by Sean McP on Tue, 04/25/2017 - 12:01

Have you tried the Database Connector? what were the results?

Submitted by ChristianMichae... on Tue, 04/25/2017 - 12:21

Hi Sean,

Still newbie on this and documents in the bonitasoft are not complete. Dont have any idea about this.

2 answers


Hi Christian,

first this is a community - we all have work to do and do not get paid for contributing here (except those how work at Bonitasoft and they are not always here). Please do not get me wrong but we are more likely to help someone who has tried something than someone who obviously has not.

We do this out of the goodness of our heart, we get nothing...except some little recognition.

We all need to learn and the most important thing to learn is:

give a man a fish and you feed him for a day; teach a man to fish and you feed him for a lifetime

so if we give you the solution you will only use it for your dissertation but you will effectively learn nothing. We want you to learn and then use it forever. But that comes at a cost, you have to show us what you have done and then when there are problems we can help.

Harsh - maybe - realistic - absolutely.

I do not work for Bonitasoft just to make things clear.

However to get you started:

Who knows the step by step and sample code in inserting data into database and how to view the content of database in the UI Designer.

I'll show you how to use a connector read

  1. Create a new diagram, rename it
  2. Change the diagram name to something meaningful
  3. Click on the pool->data tab and add a process variable myName, type text, default value Christian
  4. Click on Step1 and change it to a Script Task
  5. Click Execution->Connectors In->Add
  6. Select Database->yourDatabase
  7. Give a name->next->next
  8. give the necessary details->next
  9. In the Query add the following
select * from myTable where name = '{{myName}}'
  1. click next->next
  2. click the left box and create a new variable of type list
  3. then select the variable (double click) -> Finish

You can now execute this to get all records from yourDatabase with column contents 'Christian'.

To Insert you can change the Select statement to Insert...

For the rest - sorry but the community expects you to do something first then, when you have issues, ask.


PS: While I understand this may not be the answer you're hoping for, it does indicate a possible route to the solution, please mark as resolved.

PPS - the above select will of course not work - you have to resolve all details as to the data source and how to process the results.



If possible I would recommend to use Business Data Model (BDM) feature of Bonita BPM to handle your "header" and "details" objects. BDM let you create a model of your data that will be used to generate Java object for data manipulation in Bonita and also create database tables to store the data.

If instead you want to reuse an existing database, you will need as recommended by Sean to use database connector to write the data to the database and use a REST API extension (see the SQL data source REST API extension readme) to disaply the data in a form.


Submitted by ChristianMichae... on Wed, 04/26/2017 - 01:33


But i need to store data into my database and only data into the database will be viewed by user.