# How to define an output connector ?

**URL:** https://community.ofelia.com/t/how-to-define-an-output-connector/9151
**Category:** Q&A
**Created:** [28 June 2018 14:20 UTC](https://community.ofelia.com/t/how-to-define-an-output-connector/9151 "2018-06-28T14:20:04Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![arnaud.norel-ext\_137](https://avatars.discourse-cdn.com/v4/letter/a/5e9695/32.png) [@arnaud.norel-ext\_137](https://community.ofelia.com/u/arnaud.norel-ext_137)
#### Post date: [28 June 2018 14:20 UTC](https://community.ofelia.com/t/how-to-define-an-output-connector/9151/1 "2018-06-28T14:20:04Z")

</div>

Hello  
In my step I join an output connector : i want to store my form’s values in a table microsoft sql server.  
I write this line but it doesn’t work :

INSERT INTO dbo.mytable VALUES(‘${var}’)

then i write this line and it doesnt work too !

INSERT INTO dbo.mytable VALUES(5)

Can somebody help me please ?

---

<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: [28 June 2018 18:40 UTC](https://community.ofelia.com/t/how-to-define-an-output-connector/9151/2 "2018-06-28T18:40:02Z")

</div>

You can find a lot of information about database connector usage from [this official documentation page](https://documentation.bonitasoft.com/bonita/7.7/_database) .

In can it does not help, please give more insight of what you are trying to achieve:

- When you say output connector, you mean connector out right?
- Which type of connector do you use?
- Where did you right these lines?
- Do you have any error in the Logs (Menu Help/Engine Logs)?

Cheers,

---

<div class="post-metadata">

### Author: ![arnaud.norel-ext\_137](https://avatars.discourse-cdn.com/v4/letter/a/5e9695/32.png) [@arnaud.norel-ext\_137](https://community.ofelia.com/u/arnaud.norel-ext_137)
#### Post date: [29 June 2018 08:09 UTC](https://community.ofelia.com/t/how-to-define-an-output-connector/9151/3 "2018-06-29T08:09:47Z")

</div>

- yes
- Microsoft SQL
- i write these lines here : (I select my step) Execution / Connector Out / Add / Request  
And just before I wrote the Id and password to access to my table  
And I selected sqljdbc4.jar

---

<div class="post-metadata">

### Author: ![arnaud.norel-ext\_137](https://avatars.discourse-cdn.com/v4/letter/a/5e9695/32.png) [@arnaud.norel-ext\_137](https://community.ofelia.com/u/arnaud.norel-ext_137)
#### Post date: [29 June 2018 08:58 UTC](https://community.ofelia.com/t/how-to-define-an-output-connector/9151/4 "2018-06-29T08:58:11Z")

</div>

and when I try to put this line (insert values(5) ) in test connector, it is ok.

---

<div class="post-metadata">

### Author: ![arnaud.norel-ext\_137](https://avatars.discourse-cdn.com/v4/letter/a/5e9695/32.png) [@arnaud.norel-ext\_137](https://community.ofelia.com/u/arnaud.norel-ext_137)
#### Post date: [29 June 2018 09:10 UTC](https://community.ofelia.com/t/how-to-define-an-output-connector/9151/5 "2018-06-29T09:10:17Z")

</div>

ok finally connector out works !  
But only when i try to insert constants ( INSERT INTO … VALUES(5) )  
What is the right syntax to INSERT my variable ?

---

<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: [29 June 2018 13:28 UTC](https://community.ofelia.com/t/how-to-define-an-output-connector/9151/6 "2018-06-29T13:28:15Z")

</div>

When I need to use variables, I usually click on “Switch editor…” and edit the “Query or Batch Script” expression as a “Script” (Groovy Script). This gives you a dropdown with all accessible variables that you can use.

I add a screenshot [here](https://i.imgur.com/sJHofHa.png) for your reference.

---

<div class="post-metadata">

### Author: ![arnaud.norel-ext\_137](https://avatars.discourse-cdn.com/v4/letter/a/5e9695/32.png) [@arnaud.norel-ext\_137](https://community.ofelia.com/u/arnaud.norel-ext_137)
#### Post date: [29 June 2018 13:56 UTC](https://community.ofelia.com/t/how-to-define-an-output-connector/9151/7 "2018-06-29T13:56:24Z")

</div>

Thank you

Now I have a new issue : I define an INT (nombreJours) in my business data (demande) and my request is

INSERT INTO dbo.mytable (columnb)  
VALUES(${data:demande.nombreJours})

I have an error :  
“Declared return type class java.lang.String is not compatible with evaluated type class java.lang.Integer for expression data:demande.nombreJours”

But I never define “demande” as a STRING ! I always define it as an INT  
May be can we only return string with bonita ? or is possible to return INT ?

---

<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: [29 June 2018 14:04 UTC](https://community.ofelia.com/t/how-to-define-an-output-connector/9151/8 "2018-06-29T14:04:45Z")

</div>

What about using a regular Java instruction in your Groovy Script expression like:

`return "INSERT..." + demande.nombreJours + "...";`

I never use “$” or “data:” on my side so not sure why it would end up with error.

---

<div class="post-metadata">

### Author: ![arnaud.norel-ext\_137](https://avatars.discourse-cdn.com/v4/letter/a/5e9695/32.png) [@arnaud.norel-ext\_137](https://community.ofelia.com/u/arnaud.norel-ext_137)
#### Post date: [29 June 2018 14:25 UTC](https://community.ofelia.com/t/how-to-define-an-output-connector/9151/9 "2018-06-29T14:25:18Z")

</div>

Thank you very much !
