HCL Commerce Version or later

Configuring central database access to the Utility Docker container

Centralized configuration of database access information allows utilities to run without having to directly specify login and other information. Using this feature, the Utility Docker container will have the information available after being created. There are three ways to make centralized database connection information available to the Utility Docker container.

About this task

After database access information is centralized using this feature, every Utility Docker container that is created will have the database information built into it. The startup process involves:
  1. Collecting the database access information.
  2. Placing the database access information in the following file:
After this startup process is complete, the database access information will be available to each utility that uses that file. There can be multiple such database profiles created in this way. Each profile consists of a JDBC URL, a user and a password, and is associated with a database type (DB2 or Oracle). There is always a profile called "default". Here is an example of how a database profile is defined in alldbconnector.xml:
<override identifier= "default" enabled="yes">  
    <jdbcurl value="jdbc:db2://vm32.mycompany.com:50000/mall" enabled="yes"/>  
    <property name="user" value="wcs"/>  <property name="password" value="wcs1"/>
This database information must be available to the Utility Docker container at the time of its creation. There are three ways that the information can be made available: via Vault; through the config.properties file; or as environment variables within the Docker image itself. The configUtility.sh process will try to search for the variables in the following sequence:
  1. First, it checks for the environment variables which signal that the container is setup with Vault: VAULT_TOKEN, VAULT_URL, TENANT, ENVIRONMENT, ENVTYPE. If these are present, the database access information will be retrieved from Vault. Note that the process will not use other methods for obtaining the database access information. Therefore, if one database profile is in Vault then all need to be in Vault.
  2. If Vault environment variables are not available, the process will attempt to retrieve the database access information from environment variables.
It then writes the data to allDBConnector.xml.


Adding database login variables to Vault
  • Open a command line window in the Utility Docker container. For more information, see Running utilities from the Utility server Docker container.
    1. Use curl to add the variables for the default database profile: dbHost, dbPort, dbName, dbType, dbUser, dbPass. The following example shows the addition of the 'mall' dbName.
      curl -X POST -H "X-Vault-Token:7f47efbb-b162-619b-0ced-448079d91b77" -d '{"value":"mall"}' 
Adding profile information as environment variables
  • Instead of adding the variables to Vault as in Steps 1 and 2, you may choose to add them as environment variables instead.
    1. Open the /SETUP/ext-config/config.properties file for editing.
    2. Add the following variables to the file: DBHOST, DBPORT, DBNAME, DBTYPE, DBUSER, DBPASS.
    3. Save and exit the file.

What to do next

There are numerous parameters that you can use when starting a new Docker container. For more information, see Docker container start up logic for HCL Commerce Version or later.