# Call Stored procedure DataSource does not exist in this gateway

**URL:** <https://forum.inductiveautomation.com/t/call-stored-procedure-datasource-does-not-exist-in-this-gateway/63956>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [September 12, 2022, 4:46am UTC](https://forum.inductiveautomation.com/t/call-stored-procedure-datasource-does-not-exist-in-this-gateway/63956 "2022-09-12T04:46:53Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stephanie\_VanDelinde](https://avatars.discourse-cdn.com/v4/letter/s/e99b99/32.png) [@Stephanie\_VanDelinde](https://forum.inductiveautomation.com/u/Stephanie_VanDelinde)\
**Post date:** [September 12, 2022, 4:46am UTC](https://forum.inductiveautomation.com/t/call-stored-procedure-datasource-does-not-exist-in-this-gateway/63956/1 "2022-09-12T04:46:53Z")

</div>

I have a Stored Procedure where DBConnection in the Gateway has the name Production\_DB  
Here is my test script.  
dbnameconnect =system.db.beginTransaction(database = “Production\_DB”)  
call = system.db.createSProcCall(“Production\_DB.dbo.usp\_iiot\_IgnitionDatasetfromSP”,dbnameconnect)  
dataset = system.db.execSProcCall(call)  
normaldataset = system.dataset.toDataSet(dataset)

The following errors occur  
Error executing system.db.execSProcCall()  
caused by: com.inductiveautomation.ignition.gateway\_interface.Gatewayexception: DataSource “c9c2f1f7-5fe3-4979 etc” does not exist in this gateway.

The Production\_DB is configured as a name database connection.

Thank you

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [September 12, 2022, 4:59am UTC](https://forum.inductiveautomation.com/t/call-stored-procedure-datasource-does-not-exist-in-this-gateway/63956/2 "2022-09-12T04:59:31Z")

</div>

Reposting formatted:

```auto
dbnameconnect =system.db.beginTransaction(database = "Production_DB")
call = system.db.createSProcCall("Production_DB.dbo.usp_iiot_IgnitionDatasetfromSP",dbnameconnect)
dataset = system.db.execSProcCall(call)
normaldataset = system.dataset.toDataSet(dataset)

```

Edit: Corrected quotes

---

<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:** [September 12, 2022, 12:25pm UTC](https://forum.inductiveautomation.com/t/call-stored-procedure-datasource-does-not-exist-in-this-gateway/63956/3 "2022-09-12T12:25:30Z")

</div>

`beginTransaction` doesn’t return a database connection. It just returns a transaction ID. You need to pass the database and that transaction ID separately to [createSProcCall](https://docs.inductiveautomation.com/display/DOC81/system.db.createSProcCall).

Also, `execSProcCall` doesn’t return anything that can be converted to a dataset. You need to use `getResultSet()` on that returned object. The manual I linked has examples.

---

<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:** [September 12, 2022, 12:28pm UTC](https://forum.inductiveautomation.com/t/call-stored-procedure-datasource-does-not-exist-in-this-gateway/63956/4 "2022-09-12T12:28:28Z")

</div>

> [@justinedwards.jle](#):
>
> Reposting formatted

You failed. Look at the quotes in your reposted code block. They've been auto-converted to "pretty" quotes. The whole point of asking the OP **edit their own** comment's pasted text is because _ **their** _ post still has the original characters and spaces.

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [September 12, 2022, 12:29pm UTC](https://forum.inductiveautomation.com/t/call-stored-procedure-datasource-does-not-exist-in-this-gateway/63956/5 "2022-09-12T12:29:40Z")

</div>

> [@pturmel](#):
>
> You failed.

Thanks for the feedback. I'll do better next time.

---

<div class="post-metadata">

**Author:** ![Stephanie\_VanDelinde](https://avatars.discourse-cdn.com/v4/letter/s/e99b99/32.png) [@Stephanie\_VanDelinde](https://forum.inductiveautomation.com/u/Stephanie_VanDelinde)\
**Post date:** [September 12, 2022, 1:39pm UTC](https://forum.inductiveautomation.com/t/call-stored-procedure-datasource-does-not-exist-in-this-gateway/63956/6 "2022-09-12T13:39:30Z")

</div>

What would be the syntax of system.db.createSProcCall(“Production\_DB.dbo.usp\_iiot\_IgnitionDatasetfromSP”,dbnameconnect)  
if my Ignition Database connection Name is Production\_DB.

---

<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:** [September 12, 2022, 1:41pm UTC](https://forum.inductiveautomation.com/t/call-stored-procedure-datasource-does-not-exist-in-this-gateway/63956/7 "2022-09-12T13:41:37Z")

</div>

Please edit your original post to mark the pasted code as a code block (highlight the code and click the \</\> button). Then I can cut and paste to show you.

{ Did you look at the documentation I linked? }

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [September 12, 2022, 2:08pm UTC](https://forum.inductiveautomation.com/t/call-stored-procedure-datasource-does-not-exist-in-this-gateway/63956/8 "2022-09-12T14:08:47Z")

</div>

@Stephanie_VanDelinde  
See picture below to illustrate what @pturmel is requesting

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/8/984a820d383a9053449ba749f90f513cc830b1b9.png)

`system.db.createSProcCall("Production_DB.dbo.usp_iiot_IgnitionDatasetfromSP",dbnameconnect)`

---

<div class="post-metadata">

**Author:** ![Stephanie\_VanDelinde](https://avatars.discourse-cdn.com/v4/letter/s/e99b99/32.png) [@Stephanie\_VanDelinde](https://forum.inductiveautomation.com/u/Stephanie_VanDelinde)\
**Post date:** [September 13, 2022, 12:09am UTC](https://forum.inductiveautomation.com/t/call-stored-procedure-datasource-does-not-exist-in-this-gateway/63956/11 "2022-09-13T00:09:42Z")

</div>

```auto
call = system.db.createSProcCall("Production_DB.dbo.usp_iiot_IgnitionDatasetfromSP","Production_DB")
system.db.execSProcCall(call)
results = call.getResultSet()

```

Caused by: com.inductiveautomation.ignition.client.gateway\_interface.GatewayException: Database ‘Production\_DB’ does not exist. Make sure that the name is entered correctly.

Production\_DB is the name of the Database connection in Galaxy  
The DB in SQL server that this is connected to is Production-DB.  
Thank you for help.

---

<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:** [September 13, 2022, 12:28am UTC](https://forum.inductiveautomation.com/t/call-stored-procedure-datasource-does-not-exist-in-this-gateway/63956/12 "2022-09-13T00:28:35Z")

</div>

Probably needs to be this:

```auto
call = system.db.createSProcCall("[Production-DB].dbo.usp_iiot_IgnitionDatasetfromSP","Production_DB")
system.db.execSProcCall(call)
results = call.getResultSet()

```

Or possibly just:

```auto
call = system.db.createSProcCall("dbo.usp_iiot_IgnitionDatasetfromSP","Production_DB")
system.db.execSProcCall(call)
results = call.getResultSet()

```

---

<div class="post-metadata">

**Author:** ![Stephanie\_VanDelinde](https://avatars.discourse-cdn.com/v4/letter/s/e99b99/32.png) [@Stephanie\_VanDelinde](https://forum.inductiveautomation.com/u/Stephanie_VanDelinde)\
**Post date:** [September 13, 2022, 12:43am UTC](https://forum.inductiveautomation.com/t/call-stored-procedure-datasource-does-not-exist-in-this-gateway/63956/13 "2022-09-13T00:43:02Z")

</div>

The first call worked. Thank you so much.
