# Get list of database connections

**URL:** <https://forum.inductiveautomation.com/t/get-list-of-database-connections/3447>\
**Category:** Module Development\
**Created:** [October 17, 2011, 5:20pm UTC](https://forum.inductiveautomation.com/t/get-list-of-database-connections/3447 "2011-10-17T17:20:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![denji26](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/denji26/32/5805_2.png) [@denji26](https://forum.inductiveautomation.com/u/denji26)\
**Post date:** [October 17, 2011, 5:20pm UTC](https://forum.inductiveautomation.com/t/get-list-of-database-connections/3447/1 "2011-10-17T17:20:48Z")

</div>

How can I get a list of Ignition database connections for my module, akin to calling system.db.getConnections() from Igniton?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [October 17, 2011, 5:26pm UTC](https://forum.inductiveautomation.com/t/get-list-of-database-connections/3447/2 "2011-10-17T17:26:18Z")

</div>

You can get the DatasourceManager from GatewayContext#getDatasourceManager(), and then call DatasourceManager#getDatasources().

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [October 17, 2011, 5:28pm UTC](https://forum.inductiveautomation.com/t/get-list-of-database-connections/3447/3 "2011-10-17T17:28:09Z")

</div>

The answer depends on what context you’re programming in. On the Gateway it’s easy - you can get to the DatasourceManager from SRContext, and it has functions on it to get all of the datasources.

From the Designer or Client, you can call a function through the GatewayInterface like this:

`GatewayInterface gi = GatewayConnectionManager.getInstance().getGatewayInterface();
List<SerializableDatasourceMeta> datasources = 
			(List<SerializableDatasourceMeta>) gi.invoke("DatasourceMeta.getConnections");
`

---

<div class="post-metadata">

**Author:** ![denji26](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/denji26/32/5805_2.png) [@denji26](https://forum.inductiveautomation.com/u/denji26)\
**Post date:** [October 17, 2011, 6:10pm UTC](https://forum.inductiveautomation.com/t/get-list-of-database-connections/3447/4 "2011-10-17T18:10:24Z")

</div>

Thanks guys, I am programming in the client and was able to get the list I was looking for.

As a hopefully not too ignorant followup question, does invoking the DatasourceMeta let me call any of the functions I could call from system.db in Ignition? Extending that, does calling invoke() let me call any of the methods I could normally call from within Ignition? I only ask because I looked through the DatasourceMeta Interface in the SDK and I didn’t see a getConnections method.

Thanks again for your help!

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [October 17, 2011, 6:53pm UTC](https://forum.inductiveautomation.com/t/get-list-of-database-connections/3447/5 "2011-10-17T18:53:01Z")

</div>

The list of what’s possible through those invoke calls is not well document unfortunately, but yes, you should be able to do pretty much anything you can do through scripting calls in this way. What else would you like to do?

---

<div class="post-metadata">

**Author:** ![denji26](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/denji26/32/5805_2.png) [@denji26](https://forum.inductiveautomation.com/u/denji26)\
**Post date:** [October 17, 2011, 7:03pm UTC](https://forum.inductiveautomation.com/t/get-list-of-database-connections/3447/6 "2011-10-17T19:03:31Z")

</div>

At this time, nothing else. I was just wondering for future usage 🙂
