# Default DB from gateway script

**URL:** <https://forum.inductiveautomation.com/t/default-db-from-gateway-script/10433>\
**Category:** General Discussion\
**Created:** [September 3, 2015, 11:13pm UTC](https://forum.inductiveautomation.com/t/default-db-from-gateway-script/10433 "2015-09-03T23:13:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![CamJam](https://avatars.discourse-cdn.com/v4/letter/c/3ec8ea/32.png) [@CamJam](https://forum.inductiveautomation.com/u/CamJam)\
**Post date:** [September 3, 2015, 11:13pm UTC](https://forum.inductiveautomation.com/t/default-db-from-gateway-script/10433/1 "2015-09-03T23:13:43Z")

</div>

Hi Guys,

Is there a way to find the default DB for a project, from a gateway script?  
I can use the system.db.getConnectionsInfo() to get the default DB of the project from a client level.  
However I see the getConnectionInfo() needs a argument in a gateway script.  
I’m after a way to do this without having to change my gateway script every time I start a new project

Thanks,  
Cam

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [September 4, 2015, 1:06am UTC](https://forum.inductiveautomation.com/t/default-db-from-gateway-script/10433/2 "2015-09-04T01:06:33Z")

</div>

Hi Cam,  
Yes, but it requires installing the [Power Scripting Module](http://nickmudge.info/post/pa-power-scripting-module), which has other useful things as well.

This code will get you the default datasource in any project gateway script:`from com.inductiveautomation.ignition.common.project import ProjectVersion
context = pa.ignition.getContext()
manager = context.getProjectManager() 
projectID = manager.getProjectId(system.util.getProjectName())
props = manager.getProps(projectID, ProjectVersion.Published)
defaultDatasource = props.getDefaultDatasourceName()`Best,
