# Gateway Event Timer Script Error

**URL:** <https://forum.inductiveautomation.com/t/gateway-event-timer-script-error/17820>\
**Category:** Ignition\
**Tags:** ignition79, database, scripting\
**Created:** [April 24, 2018, 7:49pm UTC](https://forum.inductiveautomation.com/t/gateway-event-timer-script-error/17820 "2018-04-24T19:49:09Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![rrowe](https://avatars.discourse-cdn.com/v4/letter/r/c57346/32.png) [@rrowe](https://forum.inductiveautomation.com/u/rrowe)\
**Post date:** [April 24, 2018, 7:49pm UTC](https://forum.inductiveautomation.com/t/gateway-event-timer-script-error/17820/1 "2018-04-24T19:49:09Z")

</div>

I have a Gateway Timer Script set to run every 20 seconds. In the Gateway Scripts page on the Gateway, the script shows up as an Error for about 3-5 seconds and then reverts to Success. It says Success for most of the time and it takes the script about 80 milliseconds to run. What should I do to fix this?

Traceback (most recent call last):  
File “\<TimerScript:ParkdaleIgnition/JSON Script @20,000ms \>”, line 64, in   
at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.error(AbstractDBUtilities.java:364)

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

at sun.reflect.GeneratedMethodAccessor99.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()

7.9.3 (b2017060210)  
Oracle Corporation 1.8.0\_141

---

<div class="post-metadata">

**Author:** ![ethomason](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ethomason/32/43338_2.png) [@ethomason](https://forum.inductiveautomation.com/u/ethomason)\
**Post date:** [April 24, 2018, 8:28pm UTC](https://forum.inductiveautomation.com/t/gateway-event-timer-script-error/17820/2 "2018-04-24T20:28:49Z")

</div>

Can you post the script?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [April 24, 2018, 8:31pm UTC](https://forum.inductiveautomation.com/t/gateway-event-timer-script-error/17820/3 "2018-04-24T20:31:24Z")

</div>

Expand the details on that exception and follow the chain of cause to the SQLException thrown by your database.

---

<div class="post-metadata">

**Author:** ![rrowe](https://avatars.discourse-cdn.com/v4/letter/r/c57346/32.png) [@rrowe](https://forum.inductiveautomation.com/u/rrowe)\
**Post date:** [April 24, 2018, 9:06pm UTC](https://forum.inductiveautomation.com/t/gateway-event-timer-script-error/17820/4 "2018-04-24T21:06:52Z")

</div>

Here are the details on the exception, but I'm not sure where to go from here.

> com.inductiveautomation.ignition.common.script.JythonExecException: Traceback (most recent call last): File "", line 64, in at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.error(AbstractDBUtilities.java:364) at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.execSProcCall(AbstractDBUtilities.java:492) at sun.reflect.GeneratedMethodAccessor99.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:364)

> at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.execSProcCall(AbstractDBUtilities.java:492)

> at sun.reflect.GeneratedMethodAccessor99.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:438)

> at org.python.core.PyObject. **call** (PyObject.java:387)

> at org.python.core.PyObject. **call** (PyObject.java:391)

> at org.python.pycode.\_pyx44.f$0(:133)

> at org.python.pycode.\_pyx44.call\_function()

> 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:657)

> at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:616)

> at com.inductiveautomation.ignition.common.script.TimerScriptTask.run(TimerScriptTask.java:86)

> at java.util.TimerThread.mainLoop(Unknown Source)

> at java.util.TimerThread.run(Unknown Source)

> Caused by: org.python.core.PyException: Traceback (most recent call last): File "", line 64, in at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.error(AbstractDBUtilities.java:364) at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.execSProcCall(AbstractDBUtilities.java:492) at sun.reflect.GeneratedMethodAccessor99.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()

> ... 20 common frames omitted

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

> ... 19 common frames omitted

> Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The query was canceled.

> at com.microsoft.sqlserver.jdbc.TDSCommand.checkForInterrupt(IOBuffer.java:4214)

> at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:70)

> at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1449)

> 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:934)

> at com.inductiveautomation.ignition.gateway.script.GatewayDBUtilities.\_callSProc(GatewayDBUtilities.java:230)

> at com.inductiveautomation.ignition.gateway.script.GatewayDBUtilities.\_call(GatewayDBUtilities.java:284)

> at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.execSProcCall(AbstractDBUtilities.java:490)

> ... 17 common frames omitted

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [April 24, 2018, 9:40pm UTC](https://forum.inductiveautomation.com/t/gateway-event-timer-script-error/17820/5 "2018-04-24T21:40:16Z")

</div>

> [@rrowe](#):
>
> Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The query was canceled.

Microsoft is pretty unhelpful here. Did it time out, by chance?

---

<div class="post-metadata">

**Author:** ![rrowe](https://avatars.discourse-cdn.com/v4/letter/r/c57346/32.png) [@rrowe](https://forum.inductiveautomation.com/u/rrowe)\
**Post date:** [April 26, 2018, 12:37pm UTC](https://forum.inductiveautomation.com/t/gateway-event-timer-script-error/17820/7 "2018-04-26T12:37:24Z")

</div>

How would I figure that out? There was nothing that I could see that was wrong in the network and there was not an event that was created for this that I could see in the Event Viewer (unless I was looking in the wrong place).

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [April 26, 2018, 12:38pm UTC](https://forum.inductiveautomation.com/t/gateway-event-timer-script-error/17820/8 "2018-04-26T12:38:26Z")

</div>

I would look in your database logs. And turn on more logging in the database if it doesn’t give you the detail you need.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [April 26, 2018, 12:39pm UTC](https://forum.inductiveautomation.com/t/gateway-event-timer-script-error/17820/9 "2018-04-26T12:39:34Z")

</div>

Also, consider extracting the actual SQL statement and running it from Microsoft’s Management Studio.
