top of page
Search

Using HCL DB2 Docker image with a Commerce Toolkit

  • Jędrzej Małkiewicz
  • May 3, 2024
  • 2 min read

Introduction


HCL Software U, a portal offering online training sessions on HCL products, provides several courses on installing various HCL Commerce development environments. These courses include instructions on installing and configuring IBM DB2 for Windows to support HCL Commerce's local development. This article will introduce an alternative method that bypasses the need to install DB2 for Windows by utilizing the DB2 Docker image included with HCL Commerce.


Benefits of using HCL Commerce DB2 Docker


Using DB2 Docker images has the following benefits:

  • it allows database restorations from a higher environments, for example you may have a process where you periodically backup and restore a database from a test environment to development environments;

  • databases to support different projects can be set up quickly;

  • installation and maintenance of development environment is easier (you are anyway suggested to use Docker for the Elasticsearch based HCL Commerce environments).


Implementation


To follow along you need a fresh HCL Toolkit installation. You’ll also need a Docker runtime and a HCL Commerce DB2 Docker image that matches your toolkit version (commerce/ts-db:9.1.15.0 in my case). The image needs to be loaded to a Docker registry that you have access to. In our case we’ll put it into our local registry using docker load command.

docker load -i HCL_Commerce_Enterprise_9.1.15.0_DB2_Server_x86-64.tgz

You can check if the image was loaded successfully by running that command

docker image ls | grep commerce/ts-db

and the output should be similar to:

commerce/ts-db  9.1.15.0  86b17afbe56b  4 months ago    4.94GB

Now we’ll start the image and check the connectivity to the database (make sure that nothing is running on port 50000 or adjust the port number).

docker run -d -e LICENSE=accept --privileged -p 50000:50000 --name db2-local commerce/ts-db:9.1.15.0

To check if the image is running execute the following command:

docker inspect $(docker ps -q --filter name=db2-local) --format "{{.Name}} {{.State.Status}} {{.Config.Image}}"

upon successful execution, the terminal will display the following output:

/db2-local running commerce/ts-db:9.1.15.0

Let’s try to connect to the database! In the toolkit (RAD) open “Database Development” perspective.

ree

Configure a new DB2 connection.

ree
ree
The default password in 9.1.15.0 is 'wcs1'

If the connection is successful you should see a message like this.

ree

It's time to configure the toolkit for database use. To do this, close RAD, open a Windows terminal, and execute the setdbtype.bat command from the bin folder of your toolkit installation, ensuring to replace TOOLKIT_DIR with the actual location, such as C:\WCDE_90.

setdbtype.bat db2 TOOLKIT_DIR\lib\db2 mall db2inst1 diet4coke wcs wcs1 localhost 50000

The final steps involve initiating the toolkit and republishing the WC application on the WebSphere Commerce Test Server.


When the server is up go to localhost/wcs/resources/store/1/configuration/com.ibm.commerce.foundation.inventorySystem?langId=-1, if everything is fine the respnse will show that the store is set up to use "Non-ATP" inventory system.


Final thoughts


The approach described facilitates the integration of the DB2 Docker image included with HCL Commerce, making it ideal for learning, experimentation, and proof of concept. However, in a real-world project you need to have a more complex process that requires to handle persistence, backup & restoration processes.

If you're interested in discovering more about incorporating DB2 Docker images into your development workflow, please reach out to us.


 
 

Recent Posts

See All
Test driven development with HCL Commerce

In this article I’ll share with you how to approach test driven development (TDD) with HCL Commerce. Just to remind test driven development is a way of creating code by starting with writing a test, m

 
 
bottom of page