Creating database caches in the project settings

It is required to create database caches in the project settings > Database Configuration window. The caches contain the database connection information for project compilation (PowerServer Toolkit will connect to the target database when converting the DataWindows to C# models), and will be deployed to the PowerServer solution and then be used for the database connection for the app runtime.

To create a database cache in the Database Configuration window:

  1. Click the Database Configuration button at the bottom of the Web APIs tab.

  2. In the Database Configuration dialog, you can create different DB connection profiles to be used in different scenarios, for example, create different database connection profiles for the development environment, testing environment, production environment, etc.

    To create a new DB connection profile:

    • Click New in the DB connection profile group.

    • In the New DB connection profile dialog box, specify a name for the DB connection profile, for example, production.

      It is more efficient to create the new profile based on the settings of an existing one. You can select the Clone option below and then select an existing profile to clone from.

    You can then decide which profile to be used in the application by selecting the DB connection profile and clicking the Set as Current button.

  3. In the Database Configuration dialog, you can create the connection cache that connects with the database.

    For example, you can establish a connection with the SQL Anywhere database for the PowerBuilder demo using the following settings:

    • Click New in the upper part of the Connection configuration group.

    • In the Database Configuration dialog box, specify any text as the cache name.

    • Specify SQL Anywhere (ODBC) as the database provider.

    • Select the data source.

    • Specify the user name (for example, dba) and password (for example, sql).

    • Click Test Connection to make sure the database can be connected successfully.

    The Advanced button contains additional important settings for the database driver such as DelimitIdentifier, TrimSpaces, etc. If your database has such settings, make sure to click the Advanced button to configure those settings.

    If you select MySQL, Oracle, or Informix from the Provider listbox, you will be asked to specify a location for the required driver (MySql.Data 8.0.25, Oracle.ManagedDataAccess.Core 2.19.110, or IBM.Data.DB2.Core or allow PowerBuilder to download and install the required driver from the NuGet website.

    The packages downloaded from the NuGet website will be stored to %USERPROFILE%\.nuget\packages and cached in %USERPROFILE%\.sd\19.0\dbDrives\, so they can be automatically loaded when the MySQL or Oracle database connection is created.