1. Miguel Alzate
  2. PowerServer
  3. Monday, 4 December 2023 17:36 PM UTC

Hello Community!

I have two applications (say, APP1 and APP2), both compiled from the same source code, but each pointing to a different database (say, DB1 and DB2). When installing applications on the same server, the installer automatically creates two API folders, one for each application (in this case, APP1_API and APP2_API), which requires the creation of two different websites.

The question is, can't a single API be used for both applications (since, as I mentioned at the beginning, both have the same source code) that points to the respective DB according to the configuration of the Applications.json file, which allows specifying the database for each application?

Thanks in advance for any help!

mike S Accepted Answer Pending Moderation
  1. Monday, 4 December 2023 20:07 PM UTC
  2. PowerServer
  3. # 1

create and deploy a single application. 

During startup (in your code), you set the cachename to the database you want to connect to.  If it is just 2 databases then manually create the cachenames (which hold the database settings).  

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Monday, 4 December 2023 19:37 PM UTC
  2. PowerServer
  3. # 2

Hi Miguel;

  You should be using the "CacheName" setting in the SQLCA.DBParn field of your transaction object to direct PowerServer to the correct DB Instance (#1, #2, #3 ... etc).  HTH

Regards .. Chris

Comment
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Monday, 4 December 2023 18:06 PM UTC
  2. PowerServer
  3. # 3

If the two databases are different types (for example SQL Server and Oracle) then you need two Web APIs because the SQL generated by the deployment process for the Web API will be different for each database.

However, you don't need to do two websites.  You could run each Web API in a subfolder of the same website... for example mydomain.com/APP1_API_SQLServer and mydomain.com/APP1_API_Oracle

Comment
  1. Miguel Alzate
  2. Monday, 4 December 2023 18:25 PM UTC
Hi, Armeen. Thanks for your answer.



Both DBs are the same type (SQl Server). Anyway, the installer creates two folders, How can this be avoided?
  1. Helpful
  1. Armeen Mazda @Appeon
  2. Monday, 4 December 2023 19:29 PM UTC
It does not have the capability to create two folders for the Web APIs. Are you sure you are not confusing the other subfolders for the other components, like the client app, the cloud app launcher, PB runtime files, etc.?
  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.