How to define an output connector ?

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 ?

You can find a lot of information about database connector usage from this official documentation page .

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,

  • 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

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

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 ?

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 for your reference.

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 ?

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.

Thank you very much !