Supported database connection options

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 Dynamically mapping transaction object with cache.
#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 Setting up static database connection for the app runtime.

With any of the options, you need to create the cache in the project painter > Database page, because it is required for project compilation: the cache information is necessary for converting the DataWindows to C# models.

If you have configured more than one option, the priority order for options to take effect is: #1 -> #2.

As you can 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.

  • "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 C# solution. Although you may further update the connection configuration in the solution, the configuration from the solution 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).