# Create database connection on gateway from module

**URL:** <https://forum.inductiveautomation.com/t/create-database-connection-on-gateway-from-module/98818>\
**Category:** Module Development\
**Tags:** ignition81, database\
**Created:** [November 19, 2024, 10:29pm UTC](https://forum.inductiveautomation.com/t/create-database-connection-on-gateway-from-module/98818 "2024-11-19T22:29:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Grace\_Gan](https://avatars.discourse-cdn.com/v4/letter/g/e5b9ba/32.png) [@Grace\_Gan](https://forum.inductiveautomation.com/u/Grace_Gan)\
**Post date:** [November 19, 2024, 10:29pm UTC](https://forum.inductiveautomation.com/t/create-database-connection-on-gateway-from-module/98818/1 "2024-11-19T22:29:34Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/7/e7dcd960d98167ab3bab7c4474df836578194344.png)t  
Is it possible to create a database connection that falls under the Config \> Database \> Database Connections on module setup. I can see there is a GatewayContext.createDataSource() function but not sure if that is what I want here.

---

<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:** [November 19, 2024, 10:40pm UTC](https://forum.inductiveautomation.com/t/create-database-connection-on-gateway-from-module/98818/2 "2024-11-19T22:40:20Z")

</div>

No, not in any supported way.

It will be possible in 8.3, though not really an explicitly recommend pattern.

---

<div class="post-metadata">

**Author:** ![Grace\_Gan](https://avatars.discourse-cdn.com/v4/letter/g/e5b9ba/32.png) [@Grace\_Gan](https://forum.inductiveautomation.com/u/Grace_Gan)\
**Post date:** [November 19, 2024, 10:43pm UTC](https://forum.inductiveautomation.com/t/create-database-connection-on-gateway-from-module/98818/3 "2024-11-19T22:43:28Z")

</div>

But we can access the datasource using the DatasourceManager from the GatewayContext right? Which allows us to query the database or insert to the database.

---

<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:** [November 19, 2024, 10:44pm UTC](https://forum.inductiveautomation.com/t/create-database-connection-on-gateway-from-module/98818/4 "2024-11-19T22:44:32Z")

</div>

Yes, modules are allowed/expected to use already configured database connections. We just haven't ever really supported machine configuration of a gateway.
