1. Sim Joo Pee
  2. PowerServer
  3. Thursday, 22 June 2023 04:35 AM UTC

Hi Master,

 I want to know how to make one link "Https://app.com/w_cloud " to connect to db server 1 when user choose db server 1 and connect to db server 2 when user choose db server2.

I will create a screen for selection of which db server to connect before user enter login id and password. So, it will be only one link, https://app.com/w_cloud, and connect to choosen db server. My question is what other thing i need to configure beside setting two cahces in the project.(one is default, another cache) see picture attached.

The purpose, is to be able to let the user to use another db server when current db server is down.

Please advice. Thank you.

Attachments (1)
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 22 June 2023 14:59 PM UTC
  2. PowerServer
  3. # 1

Hi Sim;

   That would be accomplished in your PB App, as follows:

SQLCA.DBPArm = "CacheName=M_ST2"    // OR

SQLCA.DBPArm = "CacheName=M_ST2_2" 

Connect using SQLCA;

HTH

Regards ... Chris

Comment
  1. Sim Joo Pee
  2. Friday, 23 June 2023 04:17 AM UTC
Hi Chris,

Thanks but my current application is connecting to two data source in one profile. When i connect to db server 1, inside my application will connect to two data source to get data. In our environment, we will have one server for production, another server for backup when disaster happened.



So, in power server project there, in the database section, i created two db profile, one called Default, another called m_ST2(see attachment).



In database connection profile named "Default", has two cache, one i named as "Default" connecting to M_VN database, with d_xxx data source, second cache is Default1 connecting to same M_VN db, with different data source, that is d_xxx_g (See attachment )



I have second database connection profile named "M_ST2", also has two cache, one i named as "M_ST2" connecting to "M_ST2" database, with d_xxx data source, second cache is "M_ST2_2" connecting to same M_ST2 db, with different data source, that is d_xxx_g (See attachment)



So, now when user click connect to server 1/production server , i want it to use profile Default. And if user click connect to server 2/backup server, i want it to use profile M_ST2. Can you guide me how to do that? i think the one you mentioned above is referring to different data source.
  1. Helpful
  1. Armeen Mazda @Appeon
  2. Friday, 23 June 2023 14:31 PM UTC
You just code PowerScript to dynamically change the value of the CacheName property if you have one single transaction object (e.g. SQLCA) and need to connect to two different databases. Or for example if you have two different transaction objects (e.g. SQLCA and SQLCA2) then you assign the one CacheName to SQLCA and other to SQLCA2.
  1. Helpful
  1. Sim Joo Pee
  2. Saturday, 24 June 2023 02:46 AM UTC
Hi Armeen,



THanks. Currently, in my application, i have two transaction objects, sqlca for datasource 1, n_trlogged for another datasource 2. This two datasource are reside in one database server.

In business requirement, the application will be connecting to different database server(lets call it, database server A or database server B) bi-weekly. Both database server having the same two datasouce(we replicated daily). My question is how to build one URL, connecting to database server A on week 1 and the following week ,connect to database server B without need to build and redeploy the URL again with new database profile.

Hope i dnt confused you. Please see attachment earlier for sample.
  1. Helpful
There are no comments made yet.
Sim Joo Pee Accepted Answer Pending Moderation
  1. Friday, 23 June 2023 05:29 AM UTC
  2. PowerServer
  3. # 2

Hi Chris

  Please see attachment for big picture. My requirement is, one URL distribute to end user, they choose, which server to connect to . And what should application do to connect the correct db server, with two different data source.  See attachment, for sample. PC A choose server db1 or server db2(both has different ip). We called it as production site or bakcup/disaster site. My query in as stated earlier messages. Thank you.

Attachments (1)
Comment
  1. Chris Pollach @Appeon
  2. Friday, 23 June 2023 14:30 PM UTC
Hi Sim;

FYI: the ZIP you attached is empty.

Regards ... Chris
  1. Helpful
  1. Sim Joo Pee
  2. Saturday, 24 June 2023 02:31 AM UTC
ok. i reattached. please check. tq
  1. Helpful
There are no comments made yet.
Sim Joo Pee Accepted Answer Pending Moderation
  1. Saturday, 24 June 2023 02:32 AM UTC
  2. PowerServer
  3. # 3

Hi, I attached again. please advice. tq

Attachments (1)
Comment
  1. Sim Joo Pee
  2. Monday, 3 July 2023 08:58 AM UTC
Hi Chris,







I dnt understand what you mean exactly. But, what i mean build n deploy one copy of project and upload the application files and webapi files to IIS server. Only have one link https://test.com/test_app/ . What i want to ask is, what should i do, to make this one general URL link to connect to db server A or db server B dynamically? Currently my powerscript has sqlca, n_trlo, n_tr_sec, set as transaction. Do I need to make two set of transaction for different of db server A or B?
  1. Helpful
  1. Chris Pollach @Appeon
  2. Monday, 3 July 2023 11:47 AM UTC
Hi Sim;

That can all be handled by using the "CacheName" DBParm setting in all of your set of Transaction objects.

Regards ... Chris
  1. Helpful
  1. Sim Joo Pee
  2. Thursday, 6 July 2023 10:08 AM UTC
Hi

I had just replied. Please see below new message with attachment. TQ
  1. Helpful
There are no comments made yet.
Sim Joo Pee Accepted Answer Pending Moderation
  1. Thursday, 6 July 2023 10:07 AM UTC
  2. PowerServer
  3. # 4

Hi Chris,

  I had modified it to make call of the cahce name. Can you help if it is correct or not? Please see attachment. tq.

I also attached my application.json files.

SQLCA.DBParm = "CacheName='PGM_ST2'"

Attachments (1)
Comment
  1. Chris Pollach @Appeon
  2. Thursday, 6 July 2023 15:08 PM UTC
Hi Sim;

Yes, as long as the CacheName's are mapped correctly in your PowerServer Project - then that approach should work for each of your Transaction objects.

Regards ... Chris
  1. Helpful
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.