How to switch between db coneections in outsystems

Hi,

I am pulling data from two different databases, i want to switch between the db connections is there any way to do it in outsystems.

Please let me know how to do this.

Smriti

Hi Smriti,

I have never done this myself, but here's a post that could give you an idea how to achieve this:

https://www.outsystems.com/forums/discussion/33437/change-in-runtime-the-external-database-connection/

Hope it helps!

Regards,

Nordin

Nordin Ahdi wrote:

Hi Smriti,

I have never done this myself, but here's a post that could give you an idea how to achieve this:

https://www.outsystems.com/forums/discussion/33437/change-in-runtime-the-external-database-connection/

Hope it helps!

Regards,

Nordin

Hi Nordin,

I found a server action "DatabaseConnection_SetConnectionStringForSession" which is used to switch between db connections. I have one doubt here, even if i am able to switch between dbs, how will i exactly use the entities of two databases in preparation, for example i have entity1 in db1 and entity2 in db2, now i want to fetch data from  entity1 when user1 logs in and from entity2 if user2 logs in. I want to switch connection based on user. 

Also, after the connection is switched, in preparation of my screen where i am fetching data, the logic to get datta would use if statement, is there a way to avoid using if statements.


Smriti