1. Sim Joo Pee
  2. PowerServer
  3. Friday, 24 May 2024 07:56 AM UTC

Hi,

  I read this sentences in Appeon Help section.

'If as the app developer, you want to switch between different development, testing and even production environment for running the app.

Technique: Configuring different DB connection profiles in the PowerServer project settings. If you define the database connections in multiple profiles, the PowerServer project will be compiled against all the configured profiles. When you run the PowerServer Web APIs, you can select the actual connection profile with which the Web APIs will run.'

I had setup the database connections in multiple profiles (See attachment). But, how do i get the API to run Applications.ST1.json  instead of Applications.json? Note: My cloudapp i allow user to choose which DB to connect when login box displayed.

Can someone help to enlighten me? Thanks a lot.

Attachments (1)
Sim Joo Pee Accepted Answer Pending Moderation
  1. Thursday, 30 May 2024 03:27 AM UTC
  2. PowerServer
  3. # 1

Hi All,

 

   I finally got it solved, by using cachegroup. Thanks a lot for all the suggestion. I appreciate it a lot on the instant replied.

 

Comment
  1. Chris Pollach @Appeon
  2. Thursday, 30 May 2024 12:15 PM UTC
Hi Sim;

Thank you for the update & great news that you solved your challenge! ;-)

Regards ... Chris
  1. Helpful
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 29 May 2024 16:35 PM UTC
  2. PowerServer
  3. # 2

What you do is define multiple database connections in the applications.json and use the CacheName property in PowerScript to make your client app tell the Web API to connect to different database.  Please read this documentation: https://docs.appeon.com/ps2022r3/Using_CacheName_property.html

Comment
There are no comments made yet.
Sim Joo Pee Accepted Answer Pending Moderation
  1. Wednesday, 29 May 2024 05:22 AM UTC
  2. PowerServer
  3. # 3

Hi Chris,

 

   No, is didnt solve my requirement.

Is it possible to have multiple entry under Connectionstrings section in Appconfig.json? I want the web api know  to automatically point/connect to correct environment (for example, Dev1, or ST1 or….) when run. Is this possible? ( Please see my attachment for details)

** NOTE: I already manually snyc all the data in those three tables in all of my environments.

If the above not possible, can you suggest one for me?

Thank you.

Attachments (1)
Comment
  1. Chris Pollach @Appeon
  2. Wednesday, 29 May 2024 14:21 PM UTC
Hi Sim;

Thank you for that documentation. It looks like you want to have your PS App connect to multiple environments (aka PS Servers) simultaneously to perform the data synchronization process. Unfortunately, the current PS App design does not support that. Instead, it is designed to connect to only one PS Server instance at a time based on the Apps current Appconfig.json file value.

As a workaround though (just a 1st thought), I would suggest breaking the data synchronization task up into multiple PS Apps. That way, each App instance can connect to its relevant PS server (aka DB instance) to Retrieve/Update it's related DB instance data as required.

Note though that the "PipeLine" feature is not supported in PS Apps. So if your C/S PB App uses that mechanism today to synchronize the datum, you would have to refactor that code (basically write your own data sync) or use another mechanism (like a DB Utility) to perform that function for you.

Regards .. Chris
  1. Helpful
  1. Armeen Mazda @Appeon
  2. Wednesday, 29 May 2024 16:35 PM UTC
What you do is define multiple database connections in the applications.json and use the CacheName property in PowerScript to make your client app tell the Web API to connect to different database. Please read this documentation: https://docs.appeon.com/ps2022r3/Using_CacheName_property.html
  1. Helpful
There are no comments made yet.
Sim Joo Pee Accepted Answer Pending Moderation
  1. Monday, 27 May 2024 09:43 AM UTC
  2. PowerServer
  3. # 4

Hi Chris,

 

 THanks a lot for your suggestion. I had tried it and when i run Step 6 to create tables into db. It only create on profile cache. It didnt create the7 of the profile cache. Is it i have to insert into table by my self?

 

Please see attachment for output. Thanks again.

Attachments (1)
Comment
  1. Chris Pollach @Appeon
  2. Tuesday, 28 May 2024 14:49 PM UTC
Hi Sim;

Did David's reply solve your DB issue OK?

Regards .. Chris
  1. Helpful
There are no comments made yet.
David Xiong @Appeon Accepted Answer Pending Moderation
  1. Monday, 27 May 2024 09:12 AM UTC
  2. PowerServer
  3. # 5

Hi Sim,

The name of the currently used configuration file is stored in the "POWERSERVER_ENVIRONMENTTYPE" setting in the compiled Web API > AppConfig folder > AppConfig.json. You can directly change the value of "POWERSERVER_ENVIRONMENTTYPE" in AppConfig.json to ST1 to use this DB connection profile.

You can also set the ST1 DB connection profile as the currently used profile in the PowerServer Project. Please refer to the following link:

https://docs.appeon.com/ps2022r3/Create_the_DB_connection_profile.html

 

Regards, 

David

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 24 May 2024 14:58 PM UTC
  2. PowerServer
  3. # 6

Hi Sim;

FYI ...

1) The PowerServer "Cache" (DB instance pointer) can be defined and loaded from a Table at runtime.

=> https://docs.appeon.com/ps2022r3/Storing_the_database_connection_in_the_database.html

2) The PS App can then use the "CacheName" redirection over to PS to resolve the DB connection pointer at runtime.

=> https://docs.appeon.com/pb2022r3/connection_reference/CacheName.html

From the above, everything becomes dynamic and no JSON file configuration is required as you pass through the different environments on your way to production.   Food for thought!   ;-)

HTH

Regards .. Chris

 

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.