# Stored procedure call trouble

**URL:** <https://forum.inductiveautomation.com/t/stored-procedure-call-trouble/8249>\
**Category:** Ignition\
**Created:** [April 2, 2014, 1:34pm UTC](https://forum.inductiveautomation.com/t/stored-procedure-call-trouble/8249 "2014-04-02T13:34:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![vincent](https://avatars.discourse-cdn.com/v4/letter/v/e9bcb4/32.png) [@vincent](https://forum.inductiveautomation.com/u/vincent)\
**Post date:** [April 2, 2014, 1:34pm UTC](https://forum.inductiveautomation.com/t/stored-procedure-call-trouble/8249/1 "2014-04-02T13:34:52Z")

</div>

Hi guys,

I’am trying to call a stored procedure from ignition, but it looks like ignition truncat the procedure name.  
I created a simple button with the following script:

`call = system.db.createSProcCall("dbo.00_copy_Histo_to_report",'Databasename')
system.db.execSProcCall(call)`

The stored procedure’s name is 00\_Copy\_histo\_to\_report and I got the following error message : incorrect syntax to \_Copy\_histo\_to\_report. I guess the problem comes from the ‘00’ but i don’t understand why.

I’am running IGNTION 7.6.4 on a Windows 7 64 bits WS with a MSSQL SERVER EXPRESS 2012 database.  
The procedure is working fine under MSSQL and here is the complete error message.

thanks in advance for your support !

[code]Traceback (most recent call last):  
File “event:actionPerformed”, line 8, in   
at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.error(AbstractDBUtilities.java:323)

```
at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.execSProcCall(AbstractDBUtilities.java:451)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

```

java.lang.Exception: java.lang.Exception: Error executing system.db.execSProcCall()

```
at org.python.core.Py.JavaError(Py.java:495)
at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.error(AbstractDBUtilities.java:323)
at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.execSProcCall(AbstractDBUtilities.java:451)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.python.core.PyReflectedFunction. __call__ (PyReflectedFunction.java:186)
at com.inductiveautomation.ignition.common.script.ScriptManager$ReflectedInstanceFunction. __call__ (ScriptManager.java:460)
at org.python.core.PyObject. __call__ (PyObject.java:387)
at org.python.core.PyObject. __call__ (PyObject.java:391)
at org.python.pycode._pyx15.f$0(<event:actionPerformed>:8)
at org.python.pycode._pyx15.call_function(<event:actionPerformed>)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1275)
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:554)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.runActions(ActionAdapter.java:155)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.invoke(ActionAdapter.java:266)
at com.inductiveautomation.factorypmi.application.binding.action.RelayInvocationHandler.invoke(RelayInvocationHandler.java:55)
at com.sun.proxy.$Proxy19.actionPerformed(Unknown Source)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

```

Caused by: java.lang.Exception: Error executing system.db.execSProcCall()  
… 56 more  
Caused by: com.inductiveautomation.ignition.client.gateway\_interface.GatewayException: Syntaxe incorrecte vers ‘00’.  
at com.inductiveautomation.ignition.client.gateway\_interface.GatewayInterface.newGatewayException(GatewayInterface.java:313)  
at com.inductiveautomation.ignition.client.gateway\_interface.GatewayInterface.sendMessage(GatewayInterface.java:287)  
at com.inductiveautomation.ignition.client.gateway\_interface.GatewayInterface.sendMessage(GatewayInterface.java:244)  
at com.inductiveautomation.ignition.client.gateway\_interface.GatewayInterface.invoke(GatewayInterface.java:795)  
at com.inductiveautomation.ignition.client.script.ClientDBUtilities.\_call(ClientDBUtilities.java:182)  
at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.execSProcCall(AbstractDBUtilities.java:449)  
… 54 more  
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Syntaxe incorrecte vers ‘00’.  
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:196)  
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1454)  
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:388)  
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:338)  
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4026)  
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1416)  
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:185)  
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:160)  
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.execute(SQLServerPreparedStatement.java:320)  
at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:169)  
at com.inductiveautomation.ignition.gateway.datasource.SRConnectionWrapper$SRPreparedStatement.execute(SRConnectionWrapper.java:822)  
at com.inductiveautomation.ignition.gateway.script.GatewayDBUtilities.\_callSProc(GatewayDBUtilities.java:228)  
at com.inductiveautomation.ignition.gateway.servlets.gateway.functions.CallSProc.call(CallSProc.java:41)  
at sun.reflect.GeneratedMethodAccessor120.invoke(null)  
at sun.reflect.DelegatingMethodAccessorImpl.invoke(null)  
at java.lang.reflect.Method.invoke(null)  
at com.inductiveautomation.ignition.gateway.servlets.gateway.AbstractGatewayFunction.invoke(AbstractGatewayFunction.java:176)  
at com.inductiveautomation.ignition.gateway.servlets.Gateway.doPost(Gateway.java:373)  
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)  
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)  
at com.inductiveautomation.ignition.gateway.bootstrap.MapServlet.service(MapServlet.java:85)  
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)  
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)  
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)  
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)  
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)  
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)  
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)  
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)  
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)  
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)  
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)  
at java.lang.Thread.run(null)

Ignition v7.6.4 (b2013112117)  
Java: Oracle Corporation 1.7.0\_51  
[/code]

---

<div class="post-metadata">

**Author:** ![JGJohnson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jgjohnson/32/29582_2.png) [@JGJohnson](https://forum.inductiveautomation.com/u/JGJohnson)\
**Post date:** [April 2, 2014, 2:29pm UTC](https://forum.inductiveautomation.com/t/stored-procedure-call-trouble/8249/2 "2014-04-02T14:29:11Z")

</div>

Did you try it without dbo. in front of the procedure name?

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [April 2, 2014, 3:00pm UTC](https://forum.inductiveautomation.com/t/stored-procedure-call-trouble/8249/3 "2014-04-02T15:00:08Z")

</div>

What if you tried this:

```auto
call = system.db.createSProcCall("[dbo].[00_copy_Histo_to_report]",'Databasename')
system.db.execSProcCall(call)
```

---

<div class="post-metadata">

**Author:** ![vincent](https://avatars.discourse-cdn.com/v4/letter/v/e9bcb4/32.png) [@vincent](https://forum.inductiveautomation.com/u/vincent)\
**Post date:** [April 2, 2014, 7:05pm UTC](https://forum.inductiveautomation.com/t/stored-procedure-call-trouble/8249/4 "2014-04-02T19:05:18Z")

</div>

What if I tried this ? Well, it’s work !

Thanks a lot, I’am really impressed how quick it’s possible to get problem solved on this forum.
