# Bonita MySQL Insert Statement

**URL:** <https://community.ofelia.com/t/bonita-mysql-insert-statement/5567>\
**Category:** Q&A\
**Created:** [10 January 2015 17:39 UTC](https://community.ofelia.com/t/bonita-mysql-insert-statement/5567 "2015-01-10T17:39:42Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhone](https://avatars.discourse-cdn.com/v4/letter/j/8c91f0/32.png) [@jhone](https://community.ofelia.com/u/jhone)\
**Post date:** [10 January 2015 17:39 UTC](https://community.ofelia.com/t/bonita-mysql-insert-statement/5567/1 "2015-01-10T17:39:42Z")

</div>

Hi @all,

i am connected to a mysql database and want to make an insert statement via the mysql connector. For the query i am using the query window of the mysql connector configuration.  
My query looks like this:  
INSERT INTO `table`  
(`test`, `test2`, `test3`, `test4`)  
VALUES (‘${var}’, NULL, NULL, ${var});

Unfortunately when i am testing this insert statement in the connector configuration, bonita always shows an error: "Input parameter ‘script’ uses an expression with an not invocable reference.  
The Syntax should be ok. The variables are defined globally with a default value. The connection to the database is ok and inserts without referenced values are possible. The referenced variables are typed in with the code completion to avoid typing mistakes.

So where is the mistake?

Bonita Version: 6.3.6

---

<div class="post-metadata">

**Author:** ![arodriguezmba](https://avatars.discourse-cdn.com/v4/letter/a/71c47a/32.png) [@arodriguezmba](https://community.ofelia.com/u/arodriguezmba)\
**Post date:** [11 January 2015 00:07 UTC](https://community.ofelia.com/t/bonita-mysql-insert-statement/5567/2 "2015-01-11T00:07:25Z")

</div>

Hi, sorry for my english.

You should change the editor to create a condition, and edit a script, like the follow code:

def campo=“”  
campo= “insert into det\_requi(codigo, descripcion, cantidad, unidad, num\_requi)” +  
" values(‘“+f\_codigo+”’, ‘“+f\_descripcion+”’, ‘“+f\_cantidad+”’, ‘“+f\_unidad+”’, ‘“+idrequi+”’)"\*\*

I hope that this code help you

Agustín

---

<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:** [26 January 2015 15:18 UTC](https://community.ofelia.com/t/bonita-mysql-insert-statement/5567/3 "2015-01-26T15:18:03Z")

</div>

Hello jhone!

Sometimes Bonita maintains a reference on a variable that is already deleted. Make a try on creating a simple process from the scratch with the same variables and a mysql connector just to check this.  
Your statement seems to be right and the steps you described are ok too. Post a print screen on the Bonita popup and the log associated, if any is given.

Cheers,  
Marcos Vinícius Pinto  
MXM Sistemas  
Brasil

---

<div class="post-metadata">

**Author:** ![lurdesallaico93\_1377](https://avatars.discourse-cdn.com/v4/letter/l/76d3ee/32.png) [@lurdesallaico93\_1377](https://community.ofelia.com/u/lurdesallaico93_1377)\
**Post date:** [23 March 2019 22:23 UTC](https://community.ofelia.com/t/bonita-mysql-insert-statement/5567/4 "2019-03-23T22:23:58Z")

</div>

Hola a todos requiero ayuda estoy trabajando con la conexión a Mysql como puedo realizar una condición de búsqueda por cédula de identidad si en esta caso en la base de datos ya existe que me permita pasar a otra tarea para realizar un método en este caso de insert un nuevo registro.  
Por favor que alguien me ayude.

---

<div class="post-metadata">

**Author:** ![jhone](https://avatars.discourse-cdn.com/v4/letter/j/8c91f0/32.png) [@jhone](https://community.ofelia.com/u/jhone)\
**Post date:** [11 January 2015 08:06 UTC](https://community.ofelia.com/t/bonita-mysql-insert-statement/5567/5 "2015-01-11T08:06:41Z")

</div>

Hi arodriguezmba,

thank you for your fast suggestion. Now i changed the editor and used following lines  
in the Groovy Script:

`
def insert= ""
insert = "INSERT INTO det_requi (test, testinteger)" + " VALUES('"+referenced_var1+"', '"+referenced_var2+"')"
`

But bonita pops up again an error window: "Input parameter ‘script’ uses an expression with a not invocable reference.

Jonas

---

<div class="post-metadata">

**Author:** ![jhone](https://avatars.discourse-cdn.com/v4/letter/j/8c91f0/32.png) [@jhone](https://community.ofelia.com/u/jhone)\
**Post date:** [20 January 2015 14:57 UTC](https://community.ofelia.com/t/bonita-mysql-insert-statement/5567/6 "2015-01-20T14:57:02Z")

</div>

Any suggestions? Problem is still not solved.

---

<div class="post-metadata">

**Author:** ![jhone](https://avatars.discourse-cdn.com/v4/letter/j/8c91f0/32.png) [@jhone](https://community.ofelia.com/u/jhone)\
**Post date:** [26 January 2015 16:50 UTC](https://community.ofelia.com/t/bonita-mysql-insert-statement/5567/7 "2015-01-26T16:50:54Z")

</div>

Hi marco.pinto,

thanks for your suggestion. I solved this problem this way:  
I downloaded the latest Bonita Version. Then i made my Insert Statement like described above.  
Then i tested the Statement in the Configuration Window. Unfortunately the same error pops up. But then i checked the log files und no error was displayed. Thus the data was saved into my database. (Awesome).

So i have one hint for those who have the same problem. \*\*Don’t \*\* test your Insert Statements in the Configuration Window if you use referenced bonita variables.

---

<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:** [26 January 2015 17:39 UTC](https://community.ofelia.com/t/bonita-mysql-insert-statement/5567/8 "2015-01-26T17:39:31Z")

</div>

Hello jhone!

Sorry, but I didn’t noticed that you were “testing” in the script/connector window. Indeed this “test” does not recognize variables (any type). You need to test only with values (a fault from Bonita, in my opinion).

Cheers!  
Marcos Vinícius Pinto  
MXM Sistemas  
Brasil
