Creating a Db2 database

Create a Db2® database before installing Application Engine.

Before you begin

For high availability disaster recovery (HADR) support, you must have Db2 servers whose hostnames can be resolved to IP addresses correctly in Application Engine containers.

About this task

Tip: If you need to know which database versions are supported for your installation, use this IBM® Support External link opens a new window or tab page to generate a software compatibility report.

Procedure

  1. You can choose to create the Application Engine database by using the Db2 command line processor (CLP) or on Amazon Relational Database Service (Amazon RDS) for Db2.
    • To create the Application Engine database using Db2 CLP, run the following command in the Db2 CLP:
      CREATE DATABASE APP_ENGINE_DB_NAME AUTOMATIC STORAGE YES USING CODESET UTF-8 TERRITORY US PAGESIZE 32768;
      
      CONNECT TO APP_ENGINE_DB_NAME;
      
      CREATE BUFFERPOOL DBASBBP IMMEDIATE SIZE 1024 PAGESIZE 32K;
      
      CREATE REGULAR TABLESPACE APPENG_TS PAGESIZE 32 K MANAGED BY AUTOMATIC STORAGE BUFFERPOOL DBASBBP DROPPED TABLE RECOVERY ON;
      CREATE USER TEMPORARY TABLESPACE APPENG_TEMP_TS PAGESIZE 32 K MANAGED BY AUTOMATIC STORAGE BUFFERPOOL DBASBBP;
      
      GRANT USE OF TABLESPACE APPENG_TS TO USER APP_ENGINE_DB_USER_NAME;
      GRANT USE OF TABLESPACE APPENG_TEMP_TS TO USER APP_ENGINE_DB_USER_NAME;
      
      GRANT CONNECT ON DATABASE TO USER APP_ENGINE_DB_USER_NAME;
      
      CREATE SCHEMA APP_ENGINE_DB_SCHEMA_NAME AUTHORIZATION APP_ENGINE_DB_USER_NAME;
      
      GRANT CREATETAB ON DATABASE TO USER APP_ENGINE_DB_USER_NAME;
      
      CONNECT RESET;
      where
      • APP_ENGINE_DB_NAME is the database name for the Application Engine database, for example, AAEDB
      • APP_ENGINE_DB_USER_NAME is the username that Application Engine uses to connect to the database.
      • APP_ENGINE_DB_SCHEMA_NAME is the schema that Application Engine uses.
    • To create the Application Engine database on Amazon RDS for Db2, run the following command:
      -- Creating DB named: APP_ENGINE_DB_NAME
      CALL rdsadmin.create_database('APP_ENGINE_DB_NAME', 32768, 'UTF-8', 'US');
      
      --- Creation of the Database can take some time,Please wait for a few minutes before executing the statements below.
      
      -- Create bufferpool 
      CALL rdsadmin.create_bufferpool('APP_ENGINE_DB_NAME', 'DBASBBP', 1024, 'Y', 'Y', 32768, 0, 32);
      
      -- Create table spaces
      CALL rdsadmin.create_tablespace('APP_ENGINE_DB_NAME', 'APPENG_TS', 'DBASBBP', 32768, NULL, NULL, 'U', 'AUTOMATIC');
      CALL rdsadmin.create_tablespace('APP_ENGINE_DB_NAME', 'APPENG_TEMP_TS', 'DBASBBP', 32768, NULL, NULL, 'T', 'AUTOMATIC');
      
      -- Create role for the database with the role name of BAA
      CALL rdsadmin.create_role('APP_ENGINE_DB_NAME', 'BAA');
      -- Create a user
      CALL rdsadmin.add_user('APP_ENGINE_DB_USER_NAME', 'APP_ENGINE_DB_USER_PASSWORD', null);
      CALL rdsadmin.grant_role(?, 'APP_ENGINE_DB_NAME', 'BAA', 'USER APP_ENGINE_DB_USER_NAME', 'N');
      CALL rdsadmin.dbadm_grant(?, 'APP_ENGINE_DB_NAME', 'DATAACCESS', 'USER APP_ENGINE_DB_USER_NAME');
      
      --- Execute the below statement after the admin user is connected to the newly created Database
      GRANT SELECT ON SYSIBM.SYSVERSIONS TO USER APP_ENGINE_DB_USER_NAME;
      GRANT SELECT ON SYSCAT.DATATYPES TO USER APP_ENGINE_DB_USER_NAME;
      GRANT SELECT ON SYSCAT.INDEXES TO USER APP_ENGINE_DB_USER_NAME;
      GRANT SELECT ON SYSIBM.SYSDUMMY1 TO USER APP_ENGINE_DB_USER_NAME;
      GRANT USAGE ON WORKLOAD SYSDEFAULTUSERWORKLOAD TO USER APP_ENGINE_DB_USER_NAME;
      GRANT EXECUTE ON PACKAGE NULLID.SYSSH200 TO USER APP_ENGINE_DB_USER_NAME;
      
      GRANT USE OF TABLESPACE APPENG_TS TO USER APP_ENGINE_DB_USER_NAME;
      GRANT USE OF TABLESPACE APPENG_TEMP_TS TO USER APP_ENGINE_DB_USER_NAME;
      
      GRANT CONNECT ON DATABASE TO USER APP_ENGINE_DB_USER_NAME;
      
      CREATE SCHEMA APP_ENGINE_DB_SCHEMA_NAME AUTHORIZATION APP_ENGINE_DB_USER_NAME;
      
      GRANT CREATETAB ON DATABASE TO USER APP_ENGINE_DB_USER_NAME; 
      
      -- Done creating and tuning DB named: APP_ENGINE_DB_NAME
      where
      • APP_ENGINE_DB_NAME is the database name for the Application Engine playback server database, for example, AAEDB
      • APP_ENGINE_DB_USER_NAME is the username that Application Engine uses to connect to the database.
      • APP_ENGINE_DB_USER_PASSWORD is the password that Application Engine uses to connect to the database.
      • APP_ENGINE_DB_SCHEMA_NAME is the schema that Application Engine uses.
  2. If Business Automation Application data persistence is enabled, it needs one object store from IBM Content Cortex. You can either reuse the existing one and specify it for the object_store_name parameter or create one named something like AEOS, which stands for application engine object store.
  3. Optional: You can use your own JDBC driver to initialize the database. To use your own JDBC driver, complete the following steps.
    1. Package your JDBC files into a compressed file and use the sc_drivers_url configuration parameter to download them from an accessible web server. Follow the steps in Optional: Preparing customized versions of JDBC drivers and ICCSAP libraries.
    2. Add the customized JDBC driver information to the configuration parameters. Set application_engine_configuration.use_custom_jdbc_drivers to true in the configuration parameters. See Application Engine configuration parameters.
    Note: The JDBC driver is not used by Application Engine at runtime. Application Engine uses a Node.js library to connect to the database, and this library is not customizable.

What to do next

To protect the configuration data you are going to enter, see Creating secrets to protect sensitive configuration data.