# Switching User's Active Default DB

**URL:** <https://forum.inductiveautomation.com/t/switching-users-active-default-db/71255>\
**Category:** Ignition\
**Tags:** perspective, ignition81, scripting, database, python\
**Created:** [March 17, 2023, 7:37pm UTC](https://forum.inductiveautomation.com/t/switching-users-active-default-db/71255 "2023-03-17T19:37:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Walter\_Spilo](https://avatars.discourse-cdn.com/v4/letter/w/ea5d25/32.png) [@Walter\_Spilo](https://forum.inductiveautomation.com/u/Walter_Spilo)\
**Post date:** [March 17, 2023, 7:37pm UTC](https://forum.inductiveautomation.com/t/switching-users-active-default-db/71255/1 "2023-03-17T19:37:14Z")

</div>

Hello,

I am working on a project that can be used by multiple users for different projects they are working on. Each project has a SQL database associated with it, so moving to a different project means connecting to a different database. In the project, we have scripting that uses database name parameters to execute scripted queries, however, we also are using named queries. Right now, the way to select a new database is a setting dropdown that writes to an admin database the current "linked" database to that user's account.

Is there a script or some other way to change the user's default database at will?

Thank you!

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [March 17, 2023, 7:49pm UTC](https://forum.inductiveautomation.com/t/switching-users-active-default-db/71255/2 "2023-03-17T19:49:38Z")

</div>

Named Queries allow the Database Connection to be supplied as a parameter, so you should be able to use them in a similar way that you are doing so with scripting.

---

<div class="post-metadata">

**Author:** ![Walter\_Spilo](https://avatars.discourse-cdn.com/v4/letter/w/ea5d25/32.png) [@Walter\_Spilo](https://forum.inductiveautomation.com/u/Walter_Spilo)\
**Post date:** [March 17, 2023, 8:32pm UTC](https://forum.inductiveautomation.com/t/switching-users-active-default-db/71255/3 "2023-03-17T20:32:23Z")

</div>

Not the way I was thinking, but this might actually be a better solution. Thank you!
