# MySql stored procedure call

**URL:** <https://forum.inductiveautomation.com/t/mysql-stored-procedure-call/14700>\
**Category:** Ignition\
**Created:** [July 6, 2017, 8:00am UTC](https://forum.inductiveautomation.com/t/mysql-stored-procedure-call/14700 "2017-07-06T08:00:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pgmo](https://avatars.discourse-cdn.com/v4/letter/p/d07c76/32.png) [@pgmo](https://forum.inductiveautomation.com/u/pgmo)\
**Post date:** [July 6, 2017, 8:00am UTC](https://forum.inductiveautomation.com/t/mysql-stored-procedure-call/14700/1 "2017-07-06T08:00:51Z")

</div>

I’m used to work with MS SQL Server and this is my first time with MySql.  
I have defined a very simple Stored Procedure in my database:

```auto
CREATE DEFINER=`root`@`%` PROCEDURE `logs_test`(par1 int, out par2 int)
BEGIN
    set par2=234;
END

```

When i try to call it like that:

```auto
call=system.db.createSProcCall("logs_test")
call.registerInParam(1, system.db.INTEGER,10)
call.registerOutParam(2, system.db.INTEGER)
system.db.execSProcCall(call)

```

I get the following error:  
 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/2/20c1a1d81297cb1a3a9c613142669a8653f5b781.png)

If I try to use named paramters, it doesn’t work either and the error switches to:

![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/2/2c3af4dc9c4d1bd447f41140d9d0acc1795fd17b.png)

Any suggestion?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![mgross](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mgross/32/3311_2.png) [@mgross](https://forum.inductiveautomation.com/u/mgross)\
**Post date:** [July 6, 2017, 9:17pm UTC](https://forum.inductiveautomation.com/t/mysql-stored-procedure-call/14700/2 "2017-07-06T21:17:09Z")

</div>

Your stored procedure worked without problems for me. I can only replicate the first error if I deliberately removed “out” from par2’s definition and updated the stored procedure.

---

<div class="post-metadata">

**Author:** ![pgmo](https://avatars.discourse-cdn.com/v4/letter/p/d07c76/32.png) [@pgmo](https://forum.inductiveautomation.com/u/pgmo)\
**Post date:** [July 7, 2017, 7:46am UTC](https://forum.inductiveautomation.com/t/mysql-stored-procedure-call/14700/3 "2017-07-07T07:46:42Z")

</div>

Thanks mgross, I found I had a problem of stored procedure naming: I was used to naming my objects as **database.schema.objectname** in MS SQL Server and I was trying to replicate that in MySql. I found that, even if MySql accepts it (e.g. you get the data you want if you work in Workbench), the JDBC driver doesn’t like it, I suppose: you get errors like I reported, which are very difficult to debug.  
Moreover my first attempt to solve that naming problem was just to add a procedure with name **logs\_test** , while keeping also the **logs.test** routine in the object tree, and that was a big mistake: I think, the JDBC driver was confused by the two similar names. After deleting the **logs.test** object, it started running ok.
