A developer has several options for establishing database connections for installable cloud apps.
Option (& Priority) | Connection required for project compilation | Connection required for the app runtime |
---|---|---|
#1 | Create the caches in the project settings > Database page. For more information, refer to Configuring database caches. | Dynamic database connection --- Specify which cache will be used by the transaction object in PowerScript. For more information, refer to Using CacheName property of DBParm. |
#2 | Create the caches in the project settings > Database page. For more information, refer to Configuring database caches. | Static database connection --- Map the transaction object with the cache in the project settings > Database page > Advanced tab. For more information, refer to Static connection. |
As you can tell from the above table, during the project compilation, there is only one way to connect with the database: create the cache in the project painter > Database page (the cache is necessary for converting the DataWindows to PowerServer C# models during the project compilation).
As you can also tell from the above table, during the app runtime, there are two ways to connect with the database: static database connection, or dynamic database connection. If you have configured both options, the priority order for options to take effect is: #1 -> #2.
-
"Static database connection" (option #2) means the connection configuration (including connection cache settings, and transaction-to-cache mappings) is created before the app is run. The connection configuration is initially created in the project painter > Database page and gets deployed to the PowerServer. You may further update the connection configuration in the PowerServer, and the configuration from the PowerServer will be used during the app runtime.
-
"Dynamic database connection" means the mapping is created when the app is run. A dynamic mapping can be created in the application scripts using the DBParm CacheName property (option #1).