Connect to multiple external databases at runtime
Platform Version
11.0.606.0

Hello guys,

We have a connector for our corporate database (external) test environment. Now, we created a new instance of this database, a clone in order to test a new project. 

We have a connector for the existing corp database, but we need some applications to point to the clone of the database simultaneously, depending on what we are testing.

Is there an easy way to do this?


Regards,


Marios

 

Thanks, everyone,


Due to time shortage, what I did was clone the espaces, rename them, and consumed the connectors to the new database. This is a temporary solution.

We are most probably going to build a new Pre-Prod environment to tackle the "multiple-test-line" issues.

Thanks :)

Marios 

mvp_badge
MVP
Solution

Hello.

One of the videos in the Architecture path mentions that scenario.
https://www.outsystems.com/training/lesson/1226/core-module-patterns?LearningPathId=17

Basically, you need to set a pattern that gets the info from one connection or the other, based on a filter you set. Such filter can be the user.


mvp_badge
MVP
Solution

In these scenarios you can use the action DatabaseConnection_SetConnectionStringForSession of the PlatformRuntime API as described here

mvp_badge
MVP

Hi Marios,

What is stopping you from defining and using more than 1 external database connection in OutSystems?

Regards,

Daniel

I can define and use another external database connector. The problem is, I want to use both connectors interchangeably, depending on what data I want to test.

I want one set of users to connect on the first database and another set of users on the second database, using the same application.

mvp_badge
MVP
Solution

In these scenarios you can use the action DatabaseConnection_SetConnectionStringForSession of the PlatformRuntime API as described here

mvp_badge
MVP

As a moderator, I took the liberty to change the title of your question to better fit what you are asking for. This helps others when searching having a similar question in the future.

How do I choose which one to use at each time though?


mvp_badge
MVP

Well that part you have to organize yourself, I have not a full picture of your use case. 

  • Use a site property, if at one point in time you need to switch DB connection.
  • If it depends on other conditions (user, usergroup, role, other business rule etc.) then you will have to setup a (static) entity with the possible input attributes to the SetConnectionStringforSession component, with a record per connection. Then use logic to select the correct connection.
mvp_badge
MVP
Solution

Hello.

One of the videos in the Architecture path mentions that scenario.
https://www.outsystems.com/training/lesson/1226/core-module-patterns?LearningPathId=17

Basically, you need to set a pattern that gets the info from one connection or the other, based on a filter you set. Such filter can be the user.


Thanks, everyone,


Due to time shortage, what I did was clone the espaces, rename them, and consumed the connectors to the new database. This is a temporary solution.

We are most probably going to build a new Pre-Prod environment to tackle the "multiple-test-line" issues.

Thanks :)

Marios 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.