CONNECT to DataBase and retrieve Data
Good afternoon,
My main concern is how to connect to external database(sql server in my case) and retrieve data , to be shown in a Table in the UI Designer. What are the possibilities available to do such a thing !
I did some research , found possibility with a connector and Rest API extension. But I still don't get the main difference between both of em.
any clarification ?
regards !
Hello,
connectors and rest api extensions are indeed 2 powerful integrations available in Bonita.
If you need to retrieve data from an external database, you'd use:
- connectors in the case you need the data in the process level.
- rest api extensions if you want to use the data in the front end, like in an application page.
So you could write your logic to retrieve data in a rest api extension.
In Bonita we have a business database (bdm) available, integrated and easily reached with api.
So you could consider to store your data in a bdm and interact easily with bdm api.
Comments
Exactly, I going to use the retrieved data in a custom page , where I will integrate a table filled with the data , and apply actions on it (like Edit, save ect...) , so I go for the option of using a Rest Api Extension?
Why is not possible with a connector ? and what do you mean "process level" ?
Yes it's possible with a rest api extension, go for that.
You can technically add a connector to a process task, or at process instantiation / finalization. This is what I call process level. It's technically not possible to add a connector to a for or to custom page (front end level).
Is it clear?
Okay I will go with Rest API Extension !
Do you have any link of a real example how to connect to a database (sql server in my case) !
Especially the index.groovy file , what should I put in there ?
Here you are:
https://community.bonitasoft.com/project/data-source-rest-api-extension
Enjoy
The example is not working when I try to deploy the extension !
groovy.lang.MissingMethodException: No signature of method: groovy.json.JsonSlurper.parseText() is applicable for argument types: (java.util.LinkedHashMap) values: [[error:the parameter queryName is invalid:null]]
Possible solutions: parseText(java.lang.String), parse([B), parse([C), parse(java.io.File), parse(java.io.InputStream), parse(java.io.Reader