# Stored procedure call not using default database?

**URL:** <https://forum.inductiveautomation.com/t/stored-procedure-call-not-using-default-database/115854>\
**Category:** Ignition\
**Created:** [June 4, 2026, 9:58pm UTC](https://forum.inductiveautomation.com/t/stored-procedure-call-not-using-default-database/115854 "2026-06-04T21:58:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![eaolson](https://avatars.discourse-cdn.com/v4/letter/e/f07891/32.png) [@eaolson](https://forum.inductiveautomation.com/u/eaolson)\
**Post date:** [June 4, 2026, 9:58pm UTC](https://forum.inductiveautomation.com/t/stored-procedure-call-not-using-default-database/115854/1 "2026-06-04T21:58:06Z")

</div>

I've been fighting with a stored procedure this afternoon. The tag change script I'm writing preps the call, registers the in/out parameters, then executes it. The prepare statement looked like:

`call = system.db.createSProcCall("MyProc")`

It took me a while, but I finally noticed this buried in the error stack: java.lang.IllegalArgumentException: Cannot find database connection - name cannot be empty

The documentation for createSProcCall says, "The name of the database connection to execute against. If omitted or "", the project's default database connection will be used. [optional]", so I didn't think I needed to specify the database connection name. Once I added that, it worked.

Am I misunderstanding how this is supposed to work? This is on Ignition 8.3.0.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 4, 2026, 10:15pm UTC](https://forum.inductiveautomation.com/t/stored-procedure-call-not-using-default-database/115854/2 "2026-06-04T22:15:37Z")

</div>

Tag _change_ script, or tag _event_ script?  
Different scoping implications/rules depending on which one you're using (configured in Gateway Events or configured directly on the tag).

That said,

> [@eaolson](#):
>
> This is on Ignition 8.3.0.

Update ASAP. There's a bunch of reasons for this, but really, 8.3.6 as soon as you can.  
I don't know off the top of my head if this is _also_ one of those reasons, but it's the first thing our support department is going to ask you to do too.

---

<div class="post-metadata">

**Author:** ![eaolson](https://avatars.discourse-cdn.com/v4/letter/e/f07891/32.png) [@eaolson](https://forum.inductiveautomation.com/u/eaolson)\
**Post date:** [June 5, 2026, 4:59pm UTC](https://forum.inductiveautomation.com/t/stored-procedure-call-not-using-default-database/115854/3 "2026-06-05T16:59:29Z")

</div>

> Tag _change_ script, or tag _event_ script?

Tag event script on the tag itself, Value Changed event.

And sorry, this is actually 8.3.6 on my development machine.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 5, 2026, 5:03pm UTC](https://forum.inductiveautomation.com/t/stored-procedure-call-not-using-default-database/115854/4 "2026-06-05T17:03:37Z")

</div>

Tag event scripts run in the context of the 'gateway scripting project', and should be looking up the default database from there, if it's specified in that project's properties.  
They do not automatically get the contextual local project like most other scripts in Ignition.

---

<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:** [June 5, 2026, 5:27pm UTC](https://forum.inductiveautomation.com/t/stored-procedure-call-not-using-default-database/115854/5 "2026-06-05T17:27:26Z")

</div>

And you really should not be making DB calls from a tag event (on the tag). You are risking complete lockup of tag event scripting if multiple event scripts try to use a broken/overloaded DB connection.

---

<div class="post-metadata">

**Author:** ![eaolson](https://avatars.discourse-cdn.com/v4/letter/e/f07891/32.png) [@eaolson](https://forum.inductiveautomation.com/u/eaolson)\
**Post date:** [June 5, 2026, 8:54pm UTC](https://forum.inductiveautomation.com/t/stored-procedure-call-not-using-default-database/115854/6 "2026-06-05T20:54:21Z")

</div>

I hadn't considered that. I'll move this into a Tag Change Gateway Event. I think each one of those runs in its own thread.
