Prepare a Db2 database


Before beginning

  1. Install an IBM Db2 server.

  2. Create a database user (dbuser). For example, wcs. By default, the WebSphere Commerce Docker containers use the specific username wcs to connect to the database. If your dbuser account is different, set the username in later steps. See: Configure database connections in Docker images.

  3. (Windows) Initialize variable to support running Db2 commands in the Windows command line.

  4. Ensure that you have access to a running Utility server Docker container.


Procedure

  1. Copy the create_database_db2.sh script from the Utility server Docker container to the machine that is running the IBM Db2 server.

    1. Use the docker cp command to copy from the container to your local filesystem. For example,

        docker cp <project_name>_utils_1:/opt/WebSphere/CommerceServer90/bin/create_database_db2.sh /var/tmp/create_database_db2.sh

    2. If we are using a remote IBM Db2 server, transfer the create_database_db2 script to your remote Db2 server into a directory that a database administrator can access.

  2. (Linux) Add execute permissions to be able to run the script.

      chmod +x create_database_db2.sh

  3. Log on as a system administrator or database administrator.

  4. Open a command line interface. (Windows)

    Note: Open the Db2 command line processor (db2cmd.exe). If the command line processor automatically displays the db2> prompt, enter quit to exit.

  5. Go to the create_database_db2 script.

  6. Run the script to create a database.

    • (Linux)

        ./create_database_db2.sh dbNamedbaUser dbaPassword dbUser

      dbName
      The name of the database to create.
      By default, the WebSphere Commerce Docker containers load to a database table named mall. If we use a different name for the database, set the dbName in later steps. In particular, in this topic, Configure database connections in Docker images.

      dbaUser
      The database administrator.

      dbaPassword
      The database administrator password.

      dbUser
      The name of a database user.
      By default, the WebSphere Commerce Docker containers use the specific username wcs to connect to the database. If your dbuser account is different, set the username in later steps. See Configure database connections in Docker images.

    For example,

      ./create_database_db2.sh mall db2inst1 passw0rd wcs

  7. Back up the database. For more information about how to back up, see BACKUP DATABASE COMMAND.

Previous topic: Installing the IBM Db2 database
Next topic: Loading the WebSphere Commerce database schema