Question about DatabaseConnection_SetConnectionStringForSession

Question about DatabaseConnection_SetConnectionStringForSession

  

Hi everyone!

What's the point of the DatabaseConnection_SetConnectionStringForSession having both a parameter for the connection name as defined in Service Center *and* a parameter for the actual connection string?

Since the connection string is already defined in Service Center, what's the point of having to specify it again in the action? From my testing the action will pretty much ignore whatever you put in the connection name parameter, except that the action will fail silently if there's no DB connection with that name, so why does it even exist and, worse than that, is mandatory?

Also, does the database change apply just to extensions? In Service Center it clearly says that the Database Connection setting only applies to extension: "Database Connections are used by extensions for integration with external databases.", but both in the actual name of the action (DatabaseConnection_SetConnectionStringForSession) and in the documentation ("Switches a Database Connection from one database to another at runtime and in the current Session.") this is a lot less vague.

Thanks for any pointers on this!

Solution

Hi Carlos,

The purpose of this API is to change the connection string of a specific database connection created on service center for the current session. That is why you need to specify which is the database connection name you are changing. This way the platform can know that everywhere that database connection is being used during that session, the connection should be changed by the connection string specified with the API.

You can find more details about this API on the following link: https://www.outsystems.com/help/servicestudio/9.0/APIs/PlatformRuntime_API/PlatformRuntime_API.htm

Hope this helps.

Ana Reis

Solution

Ah, that makes sense.

It's just that the documentation doesn't make that clear.

Maybe an example in the docs would help.