# CONNECT to DataBase and retrieve Data

**URL:** <https://community.ofelia.com/t/connect-to-database-and-retrieve-data/10396>\
**Category:** Q&A\
**Created:** [15 September 2020 13:12 UTC](https://community.ofelia.com/t/connect-to-database-and-retrieve-data/10396 "2020-09-15T13:12:37Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![FatmaGh](https://avatars.discourse-cdn.com/v4/letter/f/3e96dc/32.png) [@FatmaGh](https://community.ofelia.com/u/FatmaGh)\
**Post date:** [15 September 2020 13:12 UTC](https://community.ofelia.com/t/connect-to-database-and-retrieve-data/10396/1 "2020-09-15T13:12:37Z")

</div>

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 !&nbsp;

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 ?&nbsp;

regards !&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/community_bonitasoft/original/2X/6/6b7b18c0478f2645369e82e009b65e3b97f2cc12.svg) [@system](https://community.ofelia.com/u/system)\
**Post date:** [15 September 2020 15:45 UTC](https://community.ofelia.com/t/connect-to-database-and-retrieve-data/10396/2 "2020-09-15T15:45:18Z")

</div>

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.&nbsp;

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.

---

<div class="post-metadata">

**Author:** ![FatmaGh](https://avatars.discourse-cdn.com/v4/letter/f/3e96dc/32.png) [@FatmaGh](https://community.ofelia.com/u/FatmaGh)\
**Post date:** [15 September 2020 16:08 UTC](https://community.ofelia.com/t/connect-to-database-and-retrieve-data/10396/3 "2020-09-15T16:08:35Z")

</div>

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?&nbsp;

Why is not possible with a connector ? and what do you mean "process level" ?

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/community_bonitasoft/original/2X/6/6b7b18c0478f2645369e82e009b65e3b97f2cc12.svg) [@system](https://community.ofelia.com/u/system)\
**Post date:** [15 September 2020 20:07 UTC](https://community.ofelia.com/t/connect-to-database-and-retrieve-data/10396/4 "2020-09-15T20:07:46Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![FatmaGh](https://avatars.discourse-cdn.com/v4/letter/f/3e96dc/32.png) [@FatmaGh](https://community.ofelia.com/u/FatmaGh)\
**Post date:** [16 September 2020 08:16 UTC](https://community.ofelia.com/t/connect-to-database-and-retrieve-data/10396/5 "2020-09-16T08:16:58Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/community_bonitasoft/original/2X/6/6b7b18c0478f2645369e82e009b65e3b97f2cc12.svg) [@system](https://community.ofelia.com/u/system)\
**Post date:** [16 September 2020 10:34 UTC](https://community.ofelia.com/t/connect-to-database-and-retrieve-data/10396/6 "2020-09-16T10:34:07Z")

</div>

Here you are:

http://community.ofelia.com/project/data-source-rest-api-extension

Enjoy

---

<div class="post-metadata">

**Author:** ![FatmaGh](https://avatars.discourse-cdn.com/v4/letter/f/3e96dc/32.png) [@FatmaGh](https://community.ofelia.com/u/FatmaGh)\
**Post date:** [16 September 2020 14:42 UTC](https://community.ofelia.com/t/connect-to-database-and-retrieve-data/10396/7 "2020-09-16T14:42:34Z")

</div>

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
