Configure the database connection in the Database Configuration dialog

Tutorial 13: Connecting to the Database > Part 1: Configuring database connection for project compilation provides step-by-step instructions for how to connect to different types of database from the Database Configuration dialog.

The following uses the SQL Anywhere database as an example.

To configure the database connection in the Database Configuration dialog:

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

  2. Click New in the upper part of the Connection configuration group. 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:

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

    • Select 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 "Allow dynamic connection using the transaction LogID and LogPass" option allows the application to use the LogID and LogPass property values of the Transaction object to log in to the database server as shown in the example below (instead of using the values in the User name and Password fields). For more, refer to Using LogID and LogPass properties.

    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 .NET Core driver or allow PowerBuilder to install the required driver from the NuGet website.

    Note

    You can manually download the following .NET Core driver from the NuGet website or have PowerBuilder automatically download the driver from the NuGet website:

    • MySql.Data 8.0.25

    • Oracle.ManagedDataAccess.Core 2.19.110

    • IBM.Data.DB2.Core 2.2.0.100

    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 database connection is created.